This is my python script:
http://gsingh.pastebin.com/mc602006

This is my setup.py file for py2exe:
http://gsingh.pastebin.com/m70a19449

When I go to command prompt and run the .py file with the command,
email.py message

It works fine, it sends me an email with the message, which is what it's supposed to do. When I make the exe and run it with the command:
email.exe message

I get the following error:
http://gsingh.pastebin.com/m54db60f

and no email... I don't understand what the problem is... can anyone help me?

try gui2exe. It is front end for py2exe so that you don't need to reinvert the wheel :)

http://code.google.com/p/gui2exe/

Thanks, I like the software, but it didn't work. I get the same error... Any other ideas? Maybe someone can try compiling the code themselves and see if it works?

Your py2exe code does not work on my computer (XP, Python254) ...

# Script to make exe
from distutils.core import setup
import py2exe
setup(
    options = {'py2exe': {'bundle_files': 1}},
    console = ['email.py'],
    zipfile = None,
)

... but this works ...

# Script to make exe
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
setup(
    options = {'py2exe': {'bundle_files': 1}},
    console = ['email.py'],
    zipfile = None,
)

I tested the command line and that works. Your error trace
urllib2.URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
states that the error is in line
response = urllib2.urlopen('http://www.sygmd.org/email2.php?message=' + message)

Edited 7 Years Ago by vegaseat: n/a

Your py2exe code does not work on my computer (XP, Python254) ...

# Script to make exe
from distutils.core import setup
import py2exe
setup(
    options = {'py2exe': {'bundle_files': 1}},
    console = ['email.py'],
    zipfile = None,
)

... but this works ...

# Script to make exe
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
setup(
    options = {'py2exe': {'bundle_files': 1}},
    console = ['email.py'],
    zipfile = None,
)

I tested the command line and that works. Your error trace
urllib2.URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
states that the error is in line
response = urllib2.urlopen('http://www.sygmd.org/email2.php?message=' + message)

Actually I used the command, python setup.py py2exe, so I didn't need to add that on to the arguments list....

And that is the error I'm having a problem with, I don't get that when I just run the .py file.

Python is a scripting language not made to be compiled. Although it can be done it isn't perfect. Somethings aren't supported.

I call your code mail.py
Testet with python 2.5.4 and 2.6 run exe with no error.

If it send mail i dont know because of email2.php i guess only works for you.

from distutils.core import setup
import py2exe
import sys

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 1}},
       zipfile = None,
       
       # data_files = ['apple.jpg', 'cheese.jpg'],
       
       #Your file.py can use windows or console
       windows = [{"script": 'mail.py'}])

Edited 7 Years Ago by snippsat: n/a

This question has already been answered. Start a new discussion instead.