The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
.Py to .exe (sorry i know this has been answered again and again)
Discuss .Py to .exe (sorry i know this has been answered again and again) in the Python Programming forum on Dev Shed. .Py to .exe (sorry i know this has been answered again and again) Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

May 7th, 2004, 10:41 PM
|
|
Registered User
|
|
Join Date: May 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
.Py to .exe (sorry i know this has been answered again and again)
Umm, hi? I'm like REALLY new to python (like 2 days) and i cant get my .py into .exe with py2exe. I have all the components needed to make it, i think.
Here's my setup.py:
Code:
from distutils.core import setup
import py2exe
setup(console=["myscript.py"])
thx if u can help,
Dane
|

May 8th, 2004, 08:07 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
The only thing that comes to mind right now is that Py2exe can't find the program... so... you should check that your program is really called 'myscript.py', and that its in the same directory as 'setup.py'. If its not just to edit your setup file apropriatly nd give it another go
Hope this helps,
Mark.
__________________
programming language development: www.netytan.com – Hula
|

May 8th, 2004, 10:29 AM
|
|
Registered User
|
|
Join Date: May 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Well, i got a code:
Code:
import sys
import re
#function getFileName()
def getFileName():
global fileName
fileName = raw_input("Enter file name (rel or abs path, eg., python/file.py): ")
try:
fp = open(fileName)
fp.close()
except IOError:
print "File does not exist!"
getFileName()
#call function
getFileName()
package = re.split(":",fileName)
package = re.split("/",package[len(package) - 1])
package = re.split(".py",package[len(package) - 1])
package = package[0]
def getSetupName():
global setupName
setupName = raw_input("Enter name of setup file (or <enter> for default): ")
if(setupName == ''):
setupName = "setup.py"
try:
fp = open(setupName)
fp.close()
flag = raw_input("Setup file exists! Rewrite (0=no; else <enter>)? ")
if(flag == "1"):
getSetupName()
except IOError:
setupName = setupName
getSetupName()
fp = open(setupName,"w")
temp = """from distutils.core import setup
import py2exe
setup(name = "%s",
scripts = ["%s"],
)""" % (package,fileName)
fp.write(temp)
fp.close()
sys.argv.append("py2exe")
execfile(setupName)
fp = open(setupName,"w")
temp = ""
fp.write(temp)
fp.close()
print "\n", "Executable created!"
print "Press <enter> to exit..."
if(raw_input()):
exit
its asks me what file and what setup and it works, (i think) but i cant find the .exe. it has all the files that should be there in dist but the exe is replaced by a blank "setup.py"
|

May 8th, 2004, 10:39 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Try looking in the Py2exe directory  . I think thats the default localtion for the .exe files anyway.
Mark.
|

May 8th, 2004, 10:53 AM
|
|
Registered User
|
|
Join Date: May 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
c:\python23\lib\site-packages\py2exe doesnt have it either...
|

May 8th, 2004, 10:55 AM
|
|
Registered User
|
|
Join Date: May 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
in the dist folder, the .exe doesnt show up, but it just copies my setup.py and puts it in there! grrr
|

May 9th, 2004, 10:05 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
|
Try doing a system wide search for your_python_programs_name.exe and see what comes up. If your on XP you should check out your user folder.
Mark.
|

May 10th, 2004, 02:49 AM
|
 |
Mini me.
|
|
Join Date: Nov 2003
Location: Cambridge, UK
|
|
You should find there is a dist sub-directory in the directory where you ran the setup.py script. If py2exe ran without a problem that is where your .exe is.
Grim 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|