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 martin.panter
Recipients SegundoBob, martin.panter, r.david.murray
Date 2015-08-28.03:11:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440731508.19.0.853199071869.issue24949@psf.upfronthosting.co.za>
In-reply-to
Content
It sounds like you are trying to do a plain “import email”, and then expect all the submodules under that package to work, including “email.mime.nonmultipart”. That is not how it works. I understand the submodules and subpackages are only initialized if you ask for them explicitly. Hence the “no attribute 'mime' ” error in 3.4.

In your case perhaps you should change or extend the import statement to do

import email.mime.nonmultipart

The reason why your “from . . . import” works is it also initializes the submodule that you want, and stores it in a chain of attributes of the top-level module as a side effect.

Quickly scanning through <https://docs.python.org/3/tutorial/modules.html#packages>, <https://docs.python.org/3/reference/import.html#packages>, <https://docs.python.org/3/reference/simple_stmts.html#import>, I didn’t see anything obvious pointing out that importing a top-level package doesn’t completely initialize the whole thing. But maybe there is something already there. You might have to read about how the __init__.py internals work to pick it up.
History
Date User Action Args
2015-08-28 03:11:48martin.pantersetrecipients: + martin.panter, r.david.murray, SegundoBob
2015-08-28 03:11:48martin.pantersetmessageid: <1440731508.19.0.853199071869.issue24949@psf.upfronthosting.co.za>
2015-08-28 03:11:48martin.panterlinkissue24949 messages
2015-08-28 03:11:46martin.pantercreate