py2exe problems

I have almost written a barely usable version of Notalon, my Cornell note-taking application, so I want to turn it into an executable release version via py2exe. However, I am hitting several snags.

First of all, here is my setup.py:

#!/usr/bin/python

from distutils.core import setup
import py2exe

setup(name = ‘Notalon’,
version = ‘1.0’,
description = ‘Notalon Cornell Notes Application’,

  author = 'Saketh',
  author_email = 'saketh.bhamidipati@gmail.com',
  url = '[http://catechu.org](http://catechu.org)',
  packages = ["C:\Python24\Lib\site-packages\elementtree",

              "C:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wx"]
  )

Please bear with me, because I am wholly new to this py2exe business.

First of all, where am I supposed to specify the files in my application (
Notalon.py and NotalonWindow.py)? I think there is a “console” parameter, but I have no idea where to put it. My application uses two libraries, ElementTree and wxPython; have I linked to them correctly?

Second, why am I receiving an error about the directory to wx? Specifically, this error:
error: package directory ‘C:\Python24\Lib\site-packages\wx-2\6-msw-unicode\wx’ does not exist

Notice that it turned the period in my path to wx in my setup.py into a slash. I’m on Windows, and I’m sure some of you have gotten py2exe to work with wxPython, so I’m counting on your experience to fix this problem.

I am so close to finishing my first-ever usable application that I don’t want it to fall apart at such a simple stage.

Thanks in advance.

-Saketh

Hi Saketh,

There are two relevent parameters when it comes to running your
application: console= and windows= (or is it window= ? hmm..). The
difference is that console= will (when you run the exe) open a dos box
and run from there, whereas windows= will not. If you have written a
graphical program (and I assume you have since you're posting here :slight_smile:
), you probably want to use windows= (unless you use 'print'
statements to produce output).

Which is the script you use to start your program?

Basically, if you would start your program like this:

    python Notalon.py

then you should use the following argument to setup:

    windows=['Notalon.py']

py2exe uses clever tricks to figure out what modules you use and it
uses python to figure out where to get the code from. You don't need
to tell it where to find everything you're using.

Try this:

#### setup.py ####
#!/usr/bin/python

from distutils.core import setup
import py2exe

setup(windows=['Notalon.py'])

···

On 26/06/06, Saketh Bhamidipati <saketh.bhamidipati@gmail.com> wrote:

First of all, where am I supposed to specify the files in my application (
Notalon.py and NotalonWindow.py)? I think there is a "console" parameter,
but I have no idea where to put it. My application uses two libraries,
ElementTree and wxPython; have I linked to them correctly?

####

Then run it:

    python setup.py py2exe
    cd dist
    Notalon

You need to specify packages only if py2exe isn't bringing them in
itself (which can happen with funky dynamic imports that some modules
do).

You will also need to specify any data files you are using (eg, gifs or icons).

Finally, you need to do a bit of arcana to get the widgets to look
properly styled in Windows XP. See this post for details:
http://mail.python.org/pipermail/python-list/2004-June/226653.html

HTH!

--
John.

Thanks for the help - it works now! The widgets seem properly styled, but I’ll do the manifest thing anyway.

What about all the other parameters for setup() that I had originally? Do I need them?

···

On 6/25/06, John Fouhy john@fouhy.net wrote:

On 26/06/06, Saketh Bhamidipati saketh.bhamidipati@gmail.com wrote:

First of all, where am I supposed to specify the files in my application (
Notalon.py
and NotalonWindow.py)? I think there is a “console” parameter,
but I have no idea where to put it. My application uses two libraries,
ElementTree and wxPython; have I linked to them correctly?

Hi Saketh,

There are two relevent parameters when it comes to running your
application: console= and windows= (or is it window= ? hmm…). The
difference is that console= will (when you run the exe) open a dos box

and run from there, whereas windows= will not. If you have written a
graphical program (and I assume you have since you’re posting here :slight_smile:
), you probably want to use windows= (unless you use ‘print’
statements to produce output).

Which is the script you use to start your program?

Basically, if you would start your program like this:

python Notalon.py

then you should use the following argument to setup:

windows=['

Notalon.py’]

py2exe uses clever tricks to figure out what modules you use and it
uses python to figure out where to get the code from. You don’t need
to tell it where to find everything you’re using.

Try this:

setup.py

#!/usr/bin/python

from distutils.core import setup
import py2exe

setup(windows=[‘Notalon.py’])

Then run it:

python setup.py py2exe
cd dist

Notalon

You need to specify packages only if py2exe isn’t bringing them in
itself (which can happen with funky dynamic imports that some modules
do).

You will also need to specify any data files you are using (eg, gifs or icons).

Finally, you need to do a bit of arcana to get the widgets to look
properly styled in Windows XP. See this post for details:
http://mail.python.org/pipermail/python-list/2004-June/226653.html

HTH!


John.


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Most of them are "just" metadata. If you right-click on an executable
in Windows Explorer, you can view the metadata. Other software may
use it too. You don't _need_ them, but they're nice to have.

···

On 27/06/06, Saketh Bhamidipati <saketh.bhamidipati@gmail.com> wrote:

What about all the other parameters for setup() that I had originally? Do I
need them?

--
John.

py2exe ships with a wxPython example. Starting from that will make
things easier.
Stani

···

On 6/26/06, Saketh Bhamidipati <saketh.bhamidipati@gmail.com> wrote:

Please bear with me, because I am wholly new to this py2exe business.

--

http://pythonide.stani.be/screenshots
http://pythonide.stani.be/manual/html/manual.html