Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 29th, 2004, 09:49 AM
luckyboy luckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 57 luckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m
Reputation Power: 10
py2exe explain please

I am having problem unterstanding py2exe can someone give me a simple programme converts to exe ?

Thanks in advance

Reply With Quote
  #2  
Old April 29th, 2004, 01:32 PM
duniyadnd duniyadnd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 30 duniyadnd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 44 m 4 sec
Reputation Power: 0
found this.

Code:
"""
makeExe.py
- Simple Python script to automate the creation
  of Python executables using py2exe.

(c) 2004 Premshree Pillai (24/01/04)
http://www.qiksearch.com/
"""

## Run this file from Python root dir

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

Reply With Quote
  #3  
Old May 6th, 2004, 09:33 AM
adavidso adavidso is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 12 adavidso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 2 sec
Reputation Power: 0
Hi - tried the above - and it seems to run without error, but am having problems finding the created executable....

Any help appreciated....

Last edited by adavidso : May 6th, 2004 at 11:38 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > py2exe explain please

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap