Problem with smtplib and py2exe

Kevin kdoiron at sympatico.ca
Mon Apr 7 21:49:58 CEST 2008


Hi everyone,

I'm running Python 2.5.1 on an XP-Pro platform, with all the updates
(SP2, etc) installed. I have a program (send_file.py) that sends a
file to a service provider, using an ftp connection.  The program
works properly, and I've created an 'exe' of it, using py2exe.  It was
distrubuted to my user base a couple of weeks ago and seems to be
working well.  None of the users have Python installed on their
machines, thus the need for an 'exe' for the program.

I now need to add an email function to the program, to automatically
send an email to a select user list when the program is completed.
I've made the appropriate modifications to my code, and the program
works properly when I run it from Python.  When I try to make an exe
out of my new program, however, I get the following error:

Traceback (most recent call last):
  File "C:/Python25/send_ftp/setup.py", line 17, in <module>
    console = [{"script": 'send_file.py'}] )
  File "C:\Python25\lib\distutils\core.py", line 168, in setup
    raise SystemExit, "error: " + str(msg)
SystemExit: error: command 'C:\Python25\pythonw.exe' failed with exit
status 1

The 'setup.py' script is the same one I used to generate the 'exe' of
the original program. The email-related code was added to my
'send_file.py' program as a function - it's not a separate module.  If
all of the changes are commented out, the py2exe function works. But
as soon as I activate even the line "import smtplib", the py2exe
process spits out the error above.

If I put only the email portions of code in a test program, and run it
from Python, it works, but if I try make an 'exe' out of the test
program, I get the same error as above.

Is there an inherent incompatibility between smtplib and py2exe? Does
anyone have any ideas of how I can fix this problem?



More information about the Python-list mailing list