Message 101531 - Python tracker
Message101531
| 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:46 | michael.foord | set | recipients: + michael.foord, ncoghlan |
| 2010-03-22 20:21:46 | michael.foord | set | messageid: <1269289306.17.0.0782561601798.issue8202@psf.upfronthosting.co.za> |
| 2010-03-22 20:21:44 | michael.foord | link | issue8202 messages |
| 2010-03-22 20:21:44 | michael.foord | create | |