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 pdgoins-work
Recipients pdgoins-work
Date 2017-07-27.17:59:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501178374.54.0.548179478476.issue31058@psf.upfronthosting.co.za>
In-reply-to
Content
If modules are added to a package namespace at runtime, there is a chance that they will not be properly detected if adding the module does not also result in an update to the parent directory's st_mtime attribute.

This manifests in not being able to import the module in question, despite it clearly existing on disk and despite being to import it via a new Python interpreter if a second one is opened in parallel.

Attached is a SSCCE which reproduces this issue.  On my Windows dev machine, it works flawlessly on Python 2.7 and 3.6.  However, on a Linux VM, it works on Python 2.7 yet fails fairly consistently on Python 3.6.

I'm working around the issue by walking sys.path_importer_cache and resetting FileFinder._path_mtime to 0, forcing the cache to be recreated on the next call to FileFinder.find_spec().

This bug is admittedly a bit of a corner case, but I did end up spend many hours trying to figure out what was going on, so whether or not this gets fixed, I hope this may be useful info to someone.  Thanks for your attention.
History
Date User Action Args
2017-07-27 17:59:34pdgoins-worksetrecipients: + pdgoins-work
2017-07-27 17:59:34pdgoins-worksetmessageid: <1501178374.54.0.548179478476.issue31058@psf.upfronthosting.co.za>
2017-07-27 17:59:34pdgoins-worklinkissue31058 messages
2017-07-27 17:59:34pdgoins-workcreate