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 chris.jerdonek
Recipients chris.jerdonek, michael.foord, r.david.murray, rbcollins, slmnhq
Date 2010-03-28.16:02:47
SpamBayes Score 1.5890471e-08
Marked as misclassified No
Message-id <1269792170.42.0.591622207427.issue7559@psf.upfronthosting.co.za>
In-reply-to
Content
I was also hit by this today.

For the sake of clarity, I will restate two of the scenarios that have been mentioned in this discussion:

(1) An ImportError raised whilst importing a module (original issue)
(2) A sub-module not existing.

I think the error text should be better in both cases and not just in case (1).

Currently, both (1) and (2) yield an error like the following:

AttributeError: 'module' object has no attribute 'subpackage1'

But also in case (2), the AttributeError reveals less information than the exception that was trapped earlier:

ImportError: No module named subpackage1.subpackage2

I think in both cases the error text should state not just what module was being imported but also what module was being imported from -- e.g. root_package.subpackage1.subpackage2.  In other words, it should also include the leading parts of--

'.'.join(parts_copy)  

In my case, I passed a list of modules to unittest, and it wasn't clear which one it was failing on by looking at only the trailing segment.  Thanks.
History
Date User Action Args
2010-03-28 16:02:50chris.jerdoneksetrecipients: + chris.jerdonek, rbcollins, r.david.murray, michael.foord, slmnhq
2010-03-28 16:02:50chris.jerdoneksetmessageid: <1269792170.42.0.591622207427.issue7559@psf.upfronthosting.co.za>
2010-03-28 16:02:48chris.jerdoneklinkissue7559 messages
2010-03-28 16:02:47chris.jerdonekcreate