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.000275353
Marked as misclassified No
Message-id <>
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 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].
Date User Action Args
2010-03-22 20:21:46michael.foordsetrecipients: + michael.foord, ncoghlan
2010-03-22 20:21:46michael.foordsetmessageid: <>
2010-03-22 20:21:44michael.foordlinkissue8202 messages
2010-03-22 20:21:44michael.foordcreate