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 eryksun
Recipients eryksun, ncoghlan, ned.deily, nedbat, steve.dower
Date 2017-03-08.19:53:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
main361 can be run as a package from the current directory via -m because an empty string is in sys.path, i.e. the current directory. It imports the package, executing and then In this case, the main361 directory/zip import source is not added to sys.path.

When we run main361 as a script, the main361 package is not imported, i.e. is not executed. The siblings of the script are in the main361 directory (or zip file). Effectively this is the script directory, and it does belong in sys.path -- even in isolated mode because we trust the directory or zip file that contains 

A potential problem, however, is that we don't ensure the __main__ import source is added as an absolute path. So if the script changes the working directory, then it loses this import source and possibly (unlikely) gains a new import source if the relative path exists relative to the new working directory.
Date User Action Args
2017-03-08 19:53:54eryksunsetrecipients: + eryksun, ncoghlan, nedbat, ned.deily, steve.dower
2017-03-08 19:53:54eryksunsetmessageid: <>
2017-03-08 19:53:54eryksunlinkissue29723 messages
2017-03-08 19:53:54eryksuncreate