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 michael.foord
Recipients michael.foord, ncoghlan
Date 2010-03-22.20:21:44
SpamBayes Score 0.0002753529
Marked as misclassified No
Message-id <1269289306.17.0.0782561601798.issue8202@psf.upfronthosting.co.za>
In-reply-to
Content
When you execute "python -m package" the package is first imported with sys.argv[0] set to '-c' (and sys.modules['__main__'] exists but is empty. Then package.__main__.py is executed with the correct sys.argv[0].

This means module level code executed during the initial import that attempts to work out how the code is being executed can't use either sys.modules['__main__'] *or* sys.argv[0].
History
Date User Action Args
2010-03-22 20:21:46michael.foordsetrecipients: + michael.foord, ncoghlan
2010-03-22 20:21:46michael.foordsetmessageid: <1269289306.17.0.0782561601798.issue8202@psf.upfronthosting.co.za>
2010-03-22 20:21:44michael.foordlinkissue8202 messages
2010-03-22 20:21:44michael.foordcreate