Can't load smtplib
S-boy
sushiboy21 at gmail.com
Thu Feb 12 17:04:14 EST 2009
Thanks. Turns out I had a script I wrote called email.py in my Python
path that was screwing things up.
On Feb 12, 2:50 pm, Jean-Paul Calderone <exar... at divmod.com> wrote:
> On Thu, 12 Feb 2009 11:40:57 -0800 (PST), S-boy <sushibo... at gmail.com> wrote:
> >I can't seem to import smtplib in either a script or the command line
> >interpreter.
>
> >When I try to import smtp, there seems to be some kind of collision
> >with urllib2. I get a weird error about Web server authorization, even
> >though I'm not calling urllib2.
>
> >Any ideas on what might be causing this?
>
> >Here's the mess....
>
> >Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
> >[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
>
> >>>> import smtplib
>
> >Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/smtplib.py", line 46, in <module>
> > import email.Utils
> > File "email.py", line 4, in <module>
>
> Ooops. Here's your problem. Notice how that's not /Library/Frameworks/Python.framework/Versions/2.5/lib/>python2.5/email/? You have an "email" module that's obscuring the stdlib
>
> email package.
>
>
>
> > response = urlopen("https://webmail.canwest.com")
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 124, in urlopen
> > return _opener.open(url, data)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 387, in open
> > response = meth(req, response)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 498, in http_response
> > 'http', request, response, code, msg, hdrs)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 425, in error
> > return self._call_chain(*args)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 360, in _call_chain
> > result = func(*args)
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >python2.5/urllib2.py", line 506, in http_error_default
> > raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> >urllib2.HTTPError: HTTP Error 401: Unauthorized ( The server requires
> >authorization to fulfill the request. Access to the Web server is
> >denied. Contact the server administrator. )
>
> Jean-Paul
More information about the Python-list
mailing list