Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 December 9th, 2004, 05:26 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
PY2EXE step-by-step guide

People seem to have lots of problems with py2exe, I hope this helps:
py2exe guide

As this is fresh out off the press there maybe bugs - so any comments are appreciated.

grim
Comments on this post
shearn89 agrees: excellent!
pabloj agrees!
BeetleJuice agrees: Good use of the KISS principle.
DomSau agrees: not bad
TextParser agrees: good one
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
  #2  
Old December 9th, 2004, 06:15 AM
NewPythoner NewPythoner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Bombay, India
Posts: 159 NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level)NewPythoner User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 43 m 45 sec
Reputation Power: 7
Send a message via Yahoo to NewPythoner
The step-by-step guide was very clear and simply put!

Good one!!!!

Subha

Reply With Quote
  #3  
Old December 9th, 2004, 04:03 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Like it Grim!

That is if you hadn't guessed by the fact that I've stuck this thread to the top of the forum [for the time being] . Anyway, one trivial thing I would add is an alternative way to get the command prompt/DOS prompt under Windows,

Quote:
Start > Run > Type 'command' or 'cmd'


This isn't really that important... just a personal preference really and very handy little thing to know in general . Very cool!

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #4  
Old December 9th, 2004, 04:09 PM
jacktasia jacktasia is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: Lawrence, Kansas [KU]
Posts: 1,559 jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 14 h 4 m 35 sec
Reputation Power: 9
Send a message via AIM to jacktasia
another thing to keep in mind is that you can get to Run Dialog very fast using: Window Button+R

because using the mouse sucks.
Comments on this post
Eeeman agrees: nice little tip for an amateur like myself
__________________
Jack
---------
use code tags

become vegetarian
python? yes, sir!
unarm.org
get firefox


If I helped you then please click the "" in the upper right-hand corner of my post.

Reply With Quote
  #5  
Old December 15th, 2004, 04:01 PM
djjhouse djjhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Colorado, USA
Posts: 68 djjhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 15 h 7 m
Reputation Power: 5
Another good py2exe resource

This has helped me a number of times

PY2exe wiki
http://starship.python.net/crew/theller/moin.cgi/Py2Exe

Reply With Quote
  #6  
Old December 16th, 2004, 05:31 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Quote:
Originally Posted by djjhouse
This has helped me a number of times

PY2exe wiki
http://starship.python.net/crew/theller/moin.cgi/Py2Exe


Yep - everything you need is already described on the official py2exe website and wiki. But - based on the number of forum posts it is clear that people don't get it

My aim was to illustrate few basics such as:
* Python code is stored as modules and they are text files
* Setup.py is separate from the module you want to compile
* Create a workspace directory
* Use a DOS box to run Python


These seem to be the things that first timers don't quite get and yet the tools they want to use assume these things are already understood.

grimey

Reply With Quote
  #7  
Old January 31st, 2005, 08:21 PM
wx_uab wx_uab is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Bimingham,AL
Posts: 68 wx_uab User rank is Private First Class (20 - 50 Reputation Level)wx_uab User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 14 h 58 m 22 sec
Reputation Power: 5
Using Py2exe with Python Imaging Library (PIL )

Using Py2exe with Python Imaging Library (PIL )

Creating standalone windows executables on widows using is py2exe is pretty straight forward . But you might sometime run into unexpected problems like
You might get the follwing errors while running the exe file created by the py2exe


1 . LookupError: no codec search functions registered: can't find encodingsolution : explicitly include the encodings package:

like this : python setup.py py2exe -p encodings

Un located modules *are* normal. A lot of modules have conditional
imports of other modules that they don't really *need*. This means
py2exe tries to include them in case they are needed. This sometimes
means you have more modules than you really need - and also reports of
modules that can't be found.

2 . Include the PIL switch on the py2exe line
The py2exe line needs to be:
python setup.py py2exe -p encodings –pPIL

It worked for me even without that switch use that in case u run into problems .

3 . File "Image.pyc", line 1571, in open
IOError: cannot identify image file

Solution : In order to make PIL and PY2EXE work together all libraries of PIL need to be imported explicitly such as:

import Image
import BmpImagePlugin # if you are using bitmaps
Import JpgImagePlugin # if you are dealing with jpg images

So forth ..
Note : These explicit imports may not be necessary if you are running the python script directly but are needed if you are running the exe file created by py2exe .
Comments on this post
pabloj agrees!

Reply With Quote
  #8  
Old April 13th, 2005, 04:54 PM
Max Dismukes Max Dismukes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 54 Max Dismukes User rank is Corporal (100 - 500 Reputation Level)Max Dismukes User rank is Corporal (100 - 500 Reputation Level)Max Dismukes User rank is Corporal (100 - 500 Reputation Level)Max Dismukes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 23 m 42 sec
Reputation Power: 5
awesome man

Reply With Quote
  #9  
Old May 1st, 2005, 12:34 PM
shearn89 shearn89 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 7 shearn89 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 16 sec
Reputation Power: 0
you legend! i've been trying to get py2exe to work all day!

Reply With Quote
  #10  
Old July 27th, 2005, 10:53 AM
mulciber mulciber is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: OH
Posts: 12 mulciber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 14 m 21 sec
Reputation Power: 0
This may be a dumb question, but is there a way to make an installer for the files generated by py2exe?

Reply With Quote
  #11  
Old July 27th, 2005, 05:31 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Quote:
Originally Posted by mulciber
This may be a dumb question, but is there a way to make an installer for the files generated by py2exe?


Not a dumb question at all

I use the excellent INNO Setup which seems to handle everything I need.

grim

Reply With Quote
  #12  
Old July 27th, 2005, 10:16 PM
mulciber mulciber is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: OH
Posts: 12 mulciber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 14 m 21 sec
Reputation Power: 0
Excellent. I tried it using the example setup.py that came with py2exe for use with INNO and it worked almost perfectly except for a dll that somehow didn't get linked. I have to investigate further for what may have happened, it was msvcr71.dll. Thanks for the tip and clean tut.

Reply With Quote
  #13  
Old September 1st, 2005, 01:51 AM
Dietrich's Avatar
Dietrich Dietrich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 310 Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 58 sec
Reputation Power: 21
Smile

I have modified Paul Hardwick's code when using Py2Exe with wxPython to avoid the codec LookupError when you run the exe file.
Code:
# run this code to create a windows exe file
# save in the working directory where your code file is
# and run the program from there
from distutils.core import setup
import py2exe
import sys

sys.argv.append("py2exe")

# usually needed for wxPython code to prevent the
# "LookupError: no codec search functions registered" when you run the exe
opt = {"py2exe": {"packages": ["encodings"]}}

# insert your own code filename here ...
setup(options = opt, windows = [{"script": 'myCodeFile.py'}])

Reply With Quote
  #14  
Old September 9th, 2005, 01:28 PM
djjhouse djjhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Colorado, USA
Posts: 68 djjhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 15 h 7 m
Reputation Power: 5
FYI--new py2exe version released --0.6.2

The new version has a nifty option that can allow you to create a fast standalone executable. Other installer packages usually unzip the exe into a temp dir and run it from there. The py2exe implementation does not.

You can bundle all of the files into a "Library.zip" and have a small executable, or bundle all into one .exe .

To create one large exe,simply add the line
Code:
zipfile=None
to your setup.py.
Then from the command line, call
Code:
python setup.py py2exe --bundle 1


The bundle 2 option, also does a little less bundling.

Reply With Quote
  #15  
Old January 21st, 2006, 03:55 PM
Dietrich's Avatar
Dietrich Dietrich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 310 Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level)Dietrich User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 58 sec
Reputation Power: 21