py2exe setup script

Hi, I’m pretty unfamiliar with py2exe and I had been using it with matplotlib and it was working well. I upgraded to 0.86 and now it doesn’t work. I know this is because the installation directory is different (no longer the share folder). I thought I fixed it correctly but I get an error that indicates py2exe “can’t find lib/site-packages/matplotlib/backends or it is not a regular file”. I am assuming that it doesn’t like ‘backends’ because it is a folder and not a file. I changed my setup code to this:

data_files=[
(“matplotlibdata”,
glob.glob(os.path.join(distutils.sysconfig.PREFIX, ‘lib’, ‘site-packages’,‘matplotlib’, “*”)))]

setup(
options = options,
# The lib directory contains everything except the executables and
the python dll.
windows = [app],
data_files = data_files,
# use out build_installer class as extended py2exe build command
cmdclass = {“py2exe”: build_installer},
)

how might I change this to get it working properly? thanks!!

Jeff

···

Brings words and photos together (easily) with

PhotoMail - it’s free and works with Yahoo! Mail.

A feature I mentioned on the list a few weeks ago is in the 0.87
release that was pushed today. It is
"matplotlib.get_py2exe_datafiles()". You can see it used in the
sample setup.py script below.

Begin setup.py script

···

--------------------------------------------------------------------------------------
# For py2exe only
"""
Run with the following command (use py2exe 0.6.2 or higher)

  python.exe -OO setup.py py2exe -b 3 -c -p numarray,pytz -e numpy
"""

import os
from distutils.core import setup
import py2exe
import glob

import matplotlib

setup( version = '0.9.1',
      windows = ['nlogui.py'],
      data_files = [('', ['nlo.gif', '../vtkrotate/NMA.pdb']),
                    matplotlib.get_py2exe_datafiles()],
      options={"py2exe":{"optimize":2}},
)

On 2/22/06, Jeff Peery <jeffpeery@...9...> wrote:

Hi, I'm pretty unfamiliar with py2exe and I had been using it with
matplotlib and it was working well. I upgraded to 0.86 and now it doesn't
work. I know this is because the installation directory is different (no
longer the share folder). I thought I fixed it correctly but I get an error
that indicates py2exe "can't find
lib/site-packages/matplotlib/backends or it is not a
regular file". I am assuming that it doesn't like 'backends' because it is
a folder and not a file. I changed my setup code to this:

data_files=[
             ("matplotlibdata",
                    glob.glob(os.path.join(distutils.sysconfig.PREFIX,
'lib', 'site-packages','matplotlib', "*")))]

setup(
     options = options,
     # The lib directory contains everything except the executab les and the
python dll.
     windows = [app],
     data_files = data_files,
     # use out build_installer class as extended py2exe build command
     cmdclass = {"py2exe": build_installer},
     )

how might I change this to get it working properly? thanks!!

Jeff

________________________________
Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

Hi Charlie,

Jenny here. I'm trying to make an executable of my python program that uses
MatPlotLib. I tried your example below and I got this kind of error when I
ran the exe. I'm using python 2.3.3, MatPlotLib 0.87.3 and py2exe 0.6.5. I
really need to use the MatPlotLib don't know what to do.

Thanks,
Jenny
----Error--------------------------------------------------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "simple_plot.py", line 1, in ?
  File "pylab.pyo", line 1, in ?
  File "matplotlib\pylab.pyo", line 219, in ?
  File "matplotlib\backends\__init__.pyo", line 23, in pylab_setup
ImportError: No module named backend_tkagg

Charlie Moad wrote:

···

A feature I mentioned on the list a few weeks ago is in the 0.87
release that was pushed today. It is
"matplotlib.get_py2exe_datafiles()". You can see it used in the
sample setup.py script below.

Begin setup.py script
--------------------------------------------------------------------------------------
# For py2exe only
"""
Run with the following command (use py2exe 0.6.2 or higher)

  python.exe -OO setup.py py2exe -b 3 -c -p numarray,pytz -e numpy
"""

import os
from distutils.core import setup
import py2exe
import glob

import matplotlib

setup( version = '0.9.1',
      windows = ['nlogui.py'],
      data_files = [('', ['nlo.gif', '../vtkrotate/NMA.pdb']),
                    matplotlib.get_py2exe_datafiles()],
      options={"py2exe":{"optimize":2}},
)

On 2/22/06, Jeff Peery <jeffpeery@...9...> wrote:

Hi, I'm pretty unfamiliar with py2exe and I had been using it with
matplotlib and it was working well. I upgraded to 0.86 and now it doesn't
work. I know this is because the installation directory is different (no
longer the share folder). I thought I fixed it correctly but I get an
error
that indicates py2exe "can't find
lib/site-packages/matplotlib/backends or it is not a
regular file". I am assuming that it doesn't like 'backends' because it
is
a folder and not a file. I changed my setup code to this:

data_files=[
             ("matplotlibdata",
                    glob.glob(os.path.join(distutils.sysconfig.PREFIX,
'lib', 'site-packages','matplotlib', "*")))]

setup(
     options = options,
     # The lib directory contains everything except the executab les and
the
python dll.
     windows = [app],
     data_files = data_files,
     # use out build_installer class as extended py2exe build command
     cmdclass = {"py2exe": build_installer},
     )

how might I change this to get it working properly? thanks!!

Jeff

________________________________
Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
View this message in context: http://www.nabble.com/py2exe-setup-script-tf1172593.html#a5935932
Sent from the matplotlib - users forum at Nabble.com.