Skip to content

Commit

Permalink
pkgutil: Add get_data(), depends on pkg_resources.resource_stream().
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalcon committed Jun 26, 2015
1 parent 64041bd commit 02f81e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkgutil/pkgutil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pkg_resources

def get_data(package, resource):
f = pkg_resources.resource_stream(package, resource)
try:
return f.read()
finally:
f.close()

0 comments on commit 02f81e1

Please sign in to comment.