By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

Problem with smtplib and py2exe

P: n/a
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?
Apr 7 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Kevin" <kd*****@sympatico.cawrote in message
news:3f**********************************@8g2000hs u.googlegroups.com...
| 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

Apr 7 '08 #2

P: n/a
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'.
Apr 8 '08 #3

P: n/a
On Apr 8, 10:17 am, Kevin <kdoi...@sympatico.cawrote:
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
Apr 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.