py2exe Problems...

C:\temp\py2exe\simple_plot_gtk\dist>date_demo.exe Fatal

    > Python error: Call to API function without first calling
    > import_libnumarra y() in Src\_convmodule.c

I saw the exact same thing but it appeared to come and go as I made
minor tweaks to the setup, and could never figure out why I sometimes
got this error and sometimes did not. I added nummaray to the
packages list.

    > (I also had to copy in the lib and etc directories from
    > my GTK install to keep GTK+ happy, since it needs
    > supporting files and libraries, that's a pygtk/GTK+
    > specific thing.)

Yep, this is mentioned in the comment header of setup.py for the gtk
example (and in the FAQ). Still, it's easy to miss, as I spent about
15 minutes trying to figure out what was going wrong (it had been many
months since I wrote the example) before I read my own comment. I
added a print reminder to setup.py.

    > Even when I remove the pytz imports from the
    > simple_plot_gtk scripts py2exe doesn't seem to have any
    > problems, the pytz package include does the trick for me.

Curious to know if this works for Andrea too. It appears to work for
me with py2exe 0.5.4

    > I've attached a diff showing the minor modifications I
    > made.

Thanks, I've updated the examples on the site.

I also saw your comment on the py2exe matplotlib wiki. I changed the
init method slightly -- could you test this on your setup to make sure
it works

    if sys.platform=='win32' and sys.frozen:
    path = os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdata')
    if os.path.isdir(path): return path
    else:
        # Try again assuming sys.path[0] is a dir not a exe
        path = os.path.join(sys.path[0], 'matplotlibdata')
        if os.path.isdir(path): return path
    raise RuntimeError('Could not find the matplotlib data files')

Thanks,
JDH

Hello NG,

Curious to know if this works for Andrea too. It appears to work for
me with py2exe 0.5.4

Yes, the simple plot example works on my machine (Windows 2000, py2exe 0.5.4,
Matplotlib 0.74, wxPython 2.5.5.1). I don't know if it will work also for
my big application, but I will try as soon as I can, and I don't see any
particular reason for which it should not run.
Thanks, however, for all the work you are doing!

Andrea.

I saw the exact same thing but it appeared to come and go as I made
minor tweaks to the setup, and could never figure out why I sometimes
got this error and sometimes did not. I added nummaray to the
packages list.

I've googled on this but never found anything definitive. It'd be good
if someone figured out what's happening as it's a fairly nasty error,
but it's just easier to remember to stick that package in the packages
list.

Yep, this is mentioned in the comment header of setup.py for the gtk
example (and in the FAQ). Still, it's easy to miss, as I spent about
15 minutes trying to figure out what was going wrong (it had been many
months since I wrote the example) before I read my own comment. I
added a print reminder to setup.py.

(cough) Continuing my fine tradition of missing the helpful bits in
documentation and comments.

Curious to know if this works for Andrea too. It appears to work for
me with py2exe 0.5.4

I hope this works as it makes life a lot easier all round. If it
doesn't I'd definitely suspect a bug in py2exe.

    > I've attached a diff showing the minor modifications I
    > made.

Thanks, I've updated the examples on the site.

I also saw your comment on the py2exe matplotlib wiki. I changed the
init method slightly -- could you test this on your setup to make sure
it works

Oh yeah, I'd forgotten about that wiki comment completely.

I'll test the changed code this afternoon, thanks.

cheers,
  Michael

···

On Apr 12, 2005 3:13 PM, John Hunter <jdhunter@...4...> wrote:

Hi John,

Changing in pylab.py all the .__doc__ where either __doc__ + (only 1) or _shift_string (40 lines) is used to something along these lines:

if not Axes.axhline.__doc__ == None:
     axhline.__doc__ = _shift_string(Axes.axhline.__doc__) + """
     Addition kwargs: hold = [True|False] overrides default hold state"""

This allows to use the py2exe/Python "Optimize: 2" option again and still have documentation available.

Just tested it with the simple_plot_wxagg sample.

See you
Werner

P.S. Attached the file for your perusal.

pylab.py (71.3 KB)