Message225608
I suspect resolving this will actually need special casing on the argparse side - __main__.__spec__ will have the original details for __main__ when executed via -m of zipfile/directory execution.
Things to check for:
* "__main__.__spec__ is not None" indicates a "-m" invocation
* __main__.__spec__.name will give you the module name that was executed
* if it is exactly "__main__" then this is likely zipfile or directory execution, and sys.argv[0] will still give the correct name
* if it ends with a ".__main__", it is likely package execution, and the last segment should be dropped
* otherwise, it is normal module execution
In the latter two cases, sys.executable can be used to figure out what to put before the "-m" (we don't expose the raw C level argv to Python, although there is an open RFE to do so somewhere on the tracker). |
|
Date |
User |
Action |
Args |
2014-08-21 14:04:53 | ncoghlan | set | recipients:
+ ncoghlan, tebeka, bethard |
2014-08-21 14:04:53 | ncoghlan | set | messageid: <1408629893.54.0.995437872373.issue22240@psf.upfronthosting.co.za> |
2014-08-21 14:04:53 | ncoghlan | link | issue22240 messages |
2014-08-21 14:04:52 | ncoghlan | create | |
|