473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Problem with smtplib and py2exe

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
3 1955

"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Hughes | last post by:
I wonder if anyone can help me resolve this problem. Although my ISP (One and One) provides the facility to run Python 2.2 CGI programs, their technical support people don't seem to have any Python...
0
by: Frank Zheng | last post by:
I wrote some code to test "smtplib", but i met a problem when i call the "login(user,pass)" of the "SMTP" object. here are the codes: >>> s = smtplib.SMTP() >>> s.set_debuglevel(1) >>>...
5
by: Lad | last post by:
I try to make an exe file from my script with help of Py2exe but I am not successfull. I have my script start.py that has only one command ############### import rgs.py ############## ...
5
by: sui | last post by:
this is my code import sys, os, glob, datetime, time import smtplib ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= '...@gmail.com' pw= 'fill in here'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.