Message252450
The docs of pkgutil.get_data say "The resource argument should be in the form of a relative filename, using / as the path separator. The parent directory name .. is not allowed, and nor is a rooted name (starting with a /)."
In fact (on Python 3.5 at least):
* pkgutil.get_data("logging", "/__init__.py") works, but simply chops off the first slash, returning the contents of the stdlib's logging/__init__.py.
* pkgutil.get_data("logging", "../re.py") works, returning the contents of the stdlib's re.py.
People who actually thought about the implications of get_data/zipimport/etc. can decide whether to remove this functionality or to update the docs, I'm just reporting it.
Also, it would be nice if get_data gained a "text mode" (i.e. returning str instead of bytes and with support for universal newlines). |
|
Date |
User |
Action |
Args |
2015-10-07 03:06:14 | Antony.Lee | set | recipients:
+ Antony.Lee |
2015-10-07 03:06:14 | Antony.Lee | set | messageid: <1444187174.4.0.432847594977.issue25330@psf.upfronthosting.co.za> |
2015-10-07 03:06:14 | Antony.Lee | link | issue25330 messages |
2015-10-07 03:06:13 | Antony.Lee | create | |
|