error importing smtplib
eric.frederich at gmail.com
Thu Nov 15 20:01:23 CET 2012
Sorry, only saw your first response, didn't see the others.
I compiled Python 2.7.2 myself with --enable-shared
To create standalone applications that interact with this 3rd party program
your main C file instead of having a "main" function has a FOO_user_main
When you link your program you link against a provided foo_main.o file.
My python executable (called FOO_user_main) was created from python.c but
with main replaced with FOO_user_main.... no other differences.
I have been using this type of installation for a couple of years and
everything works fine.
I only get these errors/warnings on one environment out of 10 or so
development and qa machines.
Any help trying to figure out what is different before and after the login
would be appreciated.
Is there some place in /proc I could look to see what happened?
On Thu, Nov 15, 2012 at 11:57 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 11/15/2012 9:38 AM, Eric Frederich wrote:
>> I created some bindings to a 3rd party library.
>> I have found that when I run Python and import smtplib it works fine.
>> If I first log into the 3rd party application using my bindings however
>> I get a bunch of errors.
>> What do you think this 3rd party login could be doing that would affect
>> the ability to import smtp lib.
> I don't know what 'login' actually means,...
> This works...
>> import smtplib
>> This doesn't...
>> import smtplib
> but my first guess is that FOO_login alters the module search path so that
> at least one of smtplib, hashlib, or the _xxx modules imported by hashlib
> is being imported from a different place. To check that
> import sys
> before = sys.path
> print sys.path==before
> Similar code can check anything else accessible through sys.
>> >>> import smtplib
>> ERROR:root:code for hash sha224 was not found.
> I am puzzled by this line before the traceback. I cannot find 'ERROR' in
> either smtplib or hashlib.
> Traceback (most recent call last):
>> File "/opt/foo/python27/lib/**python2.7/hashlib.py", line 139, in
>> globals()[__func_name] = __get_hash(__func_name)
>> File "/opt/foo/python27/lib/**python2.7/hashlib.py", line 103, in
>> return __get_builtin_constructor(**name)
>> File "/opt/foo/python27/lib/**python2.7/hashlib.py", line 91, in
>> raise ValueError('unsupported hash type %s' % name)
>> ValueError: unsupported hash type sha224
> [snip similar messages]
> It is also unusual to get multiple tracebacks. *Exactly* how are you
> running python and is 2.7 what you intend to run?
> Terry Jan Reedy
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list