Author Fotis.Koutoulakis
Recipients Fotis.Koutoulakis, ncoghlan
Date 2013-12-08.23:09:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386544163.08.0.264037357048.issue19771@psf.upfronthosting.co.za>
In-reply-to
Content
Hello, I'm in the process of trying to find a solution to this problem, but I'm afraid the choice of wording at some point is kind of...ambiguous.

I have some questions I want to ask, to clear some doubts in my head:

First one is: 

"if __main__ in a package throws ImportError, runpy will incorrectly report the package as not being directly executable (when it actually claims to be executable, it's just broken)"

In the above, from what I can understand from the first part of the sentence, before the paragraph, if __main__.py is not found in a package, run py will report that it won't be directly executable. Along these lines, it's mentioned that this behaviour is incorrect, but then the sentence inside the parentheses contradicts that position, suggesting that when it does suggest it's actually executable, it's just erroneous behaviour (so both behaviours are erroneous?)

The second one is:

"This can be fixed in 3.3+ by checking for an appropriate value in the name attribute of the caught exception, and only wrapping it if the failed lookup was for the __main__ submodule we're looking for."

Ok this seems to be pretty clear, we are expected to create a new package with a __main__.py that all it does is `raise ImportError`. (Disclaimer: I may be fairly wrong here). Question is, where should we put the new package? Obviously, we shouldn't litter the "real" modules, with the testing one, but if I try to use the test folder as a package, I get "ImportError: error while finding loader for xxx"

Please be lenient with me, this is one of my very first contributions to python. I will gladly accept all feedback.
History
Date User Action Args
2013-12-08 23:09:23Fotis.Koutoulakissetrecipients: + Fotis.Koutoulakis, ncoghlan
2013-12-08 23:09:23Fotis.Koutoulakissetmessageid: <1386544163.08.0.264037357048.issue19771@psf.upfronthosting.co.za>
2013-12-08 23:09:23Fotis.Koutoulakislinkissue19771 messages
2013-12-08 23:09:22Fotis.Koutoulakiscreate