473,657 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\li b\distutils\cor e.py", line 168, in setup
raise SystemExit, "error: " + str(msg)
SystemExit: error: command 'C:\Python25\py thonw.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 1966

"Kevin" <kd*****@sympat ico.cawrote in message
news:3f******** *************** ***********@8g2 000hsu.googlegr oups.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\li b\distutils\cor e.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\py thonw.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...@sympat ico.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
2904
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 expertise. I am trying to run Gypsymail.py as a CGI program from a web form. It is nearly all working, except for the part that I have reduced to the following code: #!/usr/bin/python # the line above must contain the path to Python on your...
0
1731
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) >>> s.connect('smtp.263.net') connect: ('smtp.263.net', 25) connect: ('smtp.263.net', 25) reply: '220 Welcome to coremail System(With Anti-Spam) 2.1 for
5
2614
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 ############## (rgs.py is the real program.)
5
3115
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' SENDER= SMTPuser
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.