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 dangyogi, ncoghlan
Date 2008-04-09.03:21:15
SpamBayes Score 0.01018415
Marked as misclassified No
Message-id <1207711277.47.0.751603615969.issue2410@psf.upfronthosting.co.za>
In-reply-to
Content
Using relative imports within smtplib wouldn't have made any difference
in this case. Your dummy email package was the first one encountered on
sys.path, so the "import email.smtplib" line (which does an "import
email" internally as the first step in resolving the import, and then
tries to find "smtplib" in email.__path__) picked it up.

Putting an internal package directory on sys.path (as your example does)
is seriously bad ju-ju. It's one of the main reason why people are so
strongly discouraged from directly executing files that are stored in
package directories (along with another nasty side effect in getting two
different copies of the same module using different names, it also has
the same effect as what you did here - subpackages/modules can end up
overriding standard library modules and packages because the script
directory gets placed on sys.path).
History
Date User Action Args
2008-04-09 03:21:18ncoghlansetspambayes_score: 0.0101842 -> 0.01018415
recipients: + ncoghlan, dangyogi
2008-04-09 03:21:17ncoghlansetspambayes_score: 0.0101842 -> 0.0101842
messageid: <1207711277.47.0.751603615969.issue2410@psf.upfronthosting.co.za>
2008-04-09 03:21:16ncoghlanlinkissue2410 messages
2008-04-09 03:21:15ncoghlancreate