Nick Coghlan <[EMAIL PROTECTED]> added the comment:

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).

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2410>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to