|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
.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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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" |
|
#4
|
||||
|
||||
|
Try looking in the Py2exe directory
. I think thats the default localtion for the .exe files anyway.Mark. |
|
#5
|
|||
|
|||
|
c:\python23\lib\site-packages\py2exe doesnt have it either...
|
|
#6
|
|||
|
|||
|
in the dist folder, the .exe doesnt show up, but it just copies my setup.py and puts it in there! grrr
|
|
#7
|
||||
|
||||
|
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. |
|
#8
|
||||
|
||||
|
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 ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > .Py to .exe (sorry i know this has been answered again and again) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|