py2exe problems for a tkinter/matpotlib project - works for me, but not for others

Hi group,

I have previously had success with py2exe and matplotlib, using a specialized setup.py like the attached one (which is adapted from http://www.py2exe.org/index.cgi/MatPlotLib).

However, now I have tried to go a step further and integrate some Tkinter controls in the GUI for a prototype, see attached alphabeta.py

If I do a python setup.exe py2exe with this setup file on the attached Tkinter/matplotlib and alphabeta.exe is successfully created.

However, it does not run for everyone else:

Myself: Works like a charm

A user with a python environment who make py2exes himself: Crashes on startup with the attached error log

A user with just a Python environment: Works!

A user with no Python environment: Crashes on startup with the same log.

The log does not give me any good ideas as to how I could modify setup.py to get it working.

Any good ideas?

Some details about my environment when running py2exe

OS. Win XP SP3

Python: 2.5.2

Numpy: 1.3.0

SciPy: 0.7.1

matplotlib: 0.99.1

py2exe: 0.6.9

Additional notice:

A few days ago I asked for help getting hole through to a matplotlib/Tkinter application. I was not subscribed to this list then and could not reply on the answers. But the answers were useful, thanks! In addition, one respondend asked if I knew how to update a graph without having to clear the canvas and do everything all over?

Well, I did not know the answer at that time, but the alphabeta.py example actually does it in a “cooler way”, which updates the data in the Line2D instance, which is returned when calling subplot.plot(…)

That basic approach is also described quite well here:

http://www.scipy.org/Cookbook/Matplotlib/Animations

Maybe the alphabeta.py could be added to the examples for Tkinter integration as a slightly more advanced example of Tkinter integration?

alphabeta.py (11.7 KB)

setup.py (2.04 KB)

alphabeta.exe.log (4.57 KB)

Hi Kim,

Hi group,
I have previously had success with py2exe and matplotlib, using a
specialized setup.py like the attached one (which is adapted from
http://www.py2exe.org/index.cgi/MatPlotLib).
However, now I have tried to go a step further and integrate some
Tkinter controls in the GUI for a prototype, see attached alphabeta.py
If I do a python setup.exe py2exe with this setup file on the attached
Tkinter/matplotlib and alphabeta.exe is successfully created.
However, it does not run for everyone else:
Myself: Works like a charm
A user with a python environment who make py2exes himself: Crashes on
startup with the attached error log
A user with just a Python environment: Works!
A user with no Python environment: Crashes on startup with the same log.
The log does not give me any good ideas as to how I could modify
setup.py to get it working.
Any good ideas?

Changing the line 560 in mathtext.py from:
              font = FT2Font(basename)
to:
              font = FT2Font(str(basename))

Fixed it for me, I don't know what FT2Font does and why this matters - hopefully someone else can expand on this.

Attached your setup.py a bit simplified as you are using matplotlib 0.99.

Werner

setup.py (1.2 KB)

···

On 15/03/2010 10:57, Kim Hansen wrote: