This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author David.Pritchard
Recipients David.Pritchard
Date 2012-12-19.14:54:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1355928901.47.0.243119596238.issue16730@psf.upfronthosting.co.za>
In-reply-to
Content
In importlib/_bootstrap.py, there is a function _fill_cache which crashes when you try to run Python in any environment that is so restricted that write permissions are not allowed. You get a trace like:

Traceback (most recent call last):
  In line:
    [the import statement]
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1516, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1470, in _find_module
  File "<frozen importlib._bootstrap>", line 1305, in find_module
  File "<frozen importlib._bootstrap>", line 1284, in _get_loader
  File "<frozen importlib._bootstrap>", line 1356, in find_loader
  File "<frozen importlib._bootstrap>", line 1392, in _fill_cache
PermissionError: [Errno 13] Permission denied: '[the directory name]'

This was not an issue when I was using Python 3.2 and I suspect it has to do with the OS error refactoring. I believe it can be fixed with a two-line patch, attached. (Sorry if it is the wrong format, it's the first one I've submitted.) The patch simply treats the case of PermissionError the same was as it does when there is a FileNotFoundError. I've tested the patch and it fixes the problem.
History
Date User Action Args
2012-12-19 14:55:01David.Pritchardsetrecipients: + David.Pritchard
2012-12-19 14:55:01David.Pritchardsetmessageid: <1355928901.47.0.243119596238.issue16730@psf.upfronthosting.co.za>
2012-12-19 14:55:01David.Pritchardlinkissue16730 messages
2012-12-19 14:55:00David.Pritchardcreate