Message91287
Looks like an optimization for the common case when directories aren't
created "on the fly". Your proposal would slow down all imports (a
typical sys.path actually contains a few nonexisting directories).
Quoting PEP302:
The results of path hook checks are cached in
sys.path_importer_cache, which is a dictionary mapping path entries
to importer objects. The cache is checked before sys.path_hooks is
scanned. If it is necessary to force a rescan of sys.path_hooks, it
is possible to manually clear all or part of
sys.path_importer_cache.
So the problem is that some cached data is outdated. In this case,
after creating a directory that might be listed in sys.path, you should
clear the cached entries using either of these lines:
sys.path_importer_cache.pop("/tmp/foobar", None)
sys.path_importer_cache.clear()
and then your test code succeeds.
(I'd close the issue as 'invalid') |
|
Date |
User |
Action |
Args |
2009-08-05 00:05:58 | ggenellina | set | recipients:
+ ggenellina, cemasoniv |
2009-08-05 00:05:57 | ggenellina | set | messageid: <1249430757.72.0.400608688419.issue6636@psf.upfronthosting.co.za> |
2009-08-05 00:05:56 | ggenellina | link | issue6636 messages |
2009-08-05 00:05:55 | ggenellina | create | |
|