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 ncoghlan
Recipients belopolsky, georg.brandl, ncoghlan
Date 2008-02-22.08:39:50
SpamBayes Score 0.00047785457
Marked as misclassified No
Message-id <1203669591.99.0.807437550136.issue1877@psf.upfronthosting.co.za>
In-reply-to
Content
We don't want to restore Python 2.5 behaviour - directories containing a
__main__.py file are meant to be executable in 2.6. With your proposed
change test_cmd_line_script will fail its directory execution tests
(since those rely on the default importer to find the code for __main__).

Georg is rightly complaining about the way that the implementation
details leak through in the error message when __main__ isn't found. It
makes perfect sense to me, but anyone that isn't intimately familiar
with the import system is going to be left scratching their heads and
wondering what is going on.

I'm currently pondering an approach that involves trapping the
ImportError in _run_module_as_main and displaying different error
messages based on whether or not the module being looked for is called
__main__, and whether or not sys.argv[0] is a directory.
History
Date User Action Args
2008-02-22 08:39:52ncoghlansetspambayes_score: 0.000477855 -> 0.00047785457
recipients: + ncoghlan, georg.brandl, belopolsky
2008-02-22 08:39:52ncoghlansetspambayes_score: 0.000477855 -> 0.000477855
messageid: <1203669591.99.0.807437550136.issue1877@psf.upfronthosting.co.za>
2008-02-22 08:39:50ncoghlanlinkissue1877 messages
2008-02-22 08:39:50ncoghlancreate