code_junkie

Finding a file in a Python module distribution

Nov 10th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. >>> import pkg_resources
  2. >>> pkg_resources.resource_ filename(__name__, "foo.config")
  3. 'foo.config'
  4. >>> pkg_resources.resource_filename('tempfile', "foo.config")
  5. '/usr/lib/python2.4/foo.config'
  6.  
  7. >>> import pkg_resources
  8. >>> pkg_resources.resource_ filename(__name__, "foo.config")
  9. 'foo.config'
  10. >>> pkg_resources.resource_filename('tempfile', "foo.config")
  11. '/usr/lib/python2.4/foo.config'
Add Comment
Please, Sign In to add comment