Problem with smtplib and py2exe

K

Kevin

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?
 
T

Terry Reedy

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

I would go to that line in that file (it is in the except: part of a try:
statement) and file the function call that raised the exception and ...
There seems to be a DEBUG variable, which might also give more info.

| 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?

tjr
 
K

Kevin

Thanks, Terry, you pointed me in the right direction with the
reference to the "DEBUG".

I dug out my "Learning Python" book, to read up on the debugger, and
one of the things I came across was a section on IDLE's debugger. It
said essentially that if you get an error that doesn't make sense when
you're trying to run another program (in this case, py2exe) with IDLE,
then run the program from the command line instead. I did that, and
much to my surprise, I was able to generate the 'exe' that I needed.

I guess the incompatibility isn't necessarily between 'py2exe' and
'smtplib' after all, but between 'py2exe' and 'IDLE'.
 
M

Mike Driscoll

Thanks, Terry, you pointed me in the right direction with the
reference to the "DEBUG".

I dug out my "Learning Python" book, to read up on the debugger, and
one of the things I came across was a section on IDLE's debugger. It
said essentially that if you get an error that doesn't make sense when
you're trying to run another program (in this case, py2exe) with IDLE,
then run the program from the command line instead. I did that, and
much to my surprise, I was able to generate the 'exe' that I needed.

I guess the incompatibility isn't necessarily between 'py2exe' and
'smtplib' after all, but between 'py2exe' and 'IDLE'.

I also recommend trying out GUI2Exe, a cool GUI wrapper for the py2exe
program that allows developers to create executables quickly and
easily. It also saves all your settings, which is nice if you need to
re-compile frequently.

I found it here: http://xoomer.alice.it/infinity77/main/GUI2Exe.html

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top