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 ncoghlan
Recipients Fotis.Koutoulakis, ncoghlan
Date 2013-12-09.01:26:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386552382.99.0.980228748818.issue19771@psf.upfronthosting.co.za>
In-reply-to
Content
By providing a __main__.py submodule, a package is saying "I am directly executable". When runpy says it isn't (because running that file happened to raise ImportError), then runpy is wrong.

runpy can't make the file work (it's genuinely broken), but it can avoid reporting a misleading error message - that's the bug to be fixed.

As far as the testing goes, if you look at the existing runpy tests, the usual approach is to create a temporary directory, write out a package with the desired behaviour, and then run it from there. So, for this test, it's a matter of copying the general structure of the existing package execution test in test_runpy, but replacing the body of the __main__.py file with something like "raise ImportError('This should not be replaced')"
History
Date User Action Args
2013-12-09 01:26:23ncoghlansetrecipients: + ncoghlan, Fotis.Koutoulakis
2013-12-09 01:26:22ncoghlansetmessageid: <1386552382.99.0.980228748818.issue19771@psf.upfronthosting.co.za>
2013-12-09 01:26:22ncoghlanlinkissue19771 messages
2013-12-09 01:26:21ncoghlancreate