Author ncoghlan
Recipients bethard, ncoghlan, tebeka
Date 2014-08-21.14:04:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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
* 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:53ncoghlansetrecipients: + ncoghlan, tebeka, bethard
2014-08-21 14:04:53ncoghlansetmessageid: <>
2014-08-21 14:04:53ncoghlanlinkissue22240 messages
2014-08-21 14:04:52ncoghlancreate