matplotlib py2exe problem

Daniel McQuillen <daniel@...83...> writes:

Charlie Moad <cwmoad <at> ...> writes:

>
> I just committed the changes to cvs and added a convenience function
> for py2exe called get_py2exe_datafiles.

Charlie,

Thanks for your help. I tried running your script and got an error originating
from the function you wrote within __init__.py. I tried the function by itself
within PyShell and got the same error...here's the error I received:

  File "setup.py", line 23, in ?
    data_files = [('', ['nlo.gif', '../vtkrotate/NMA.pdb']),
  File "C:\Python24\Lib\site-packages\matplotlib\__init__.py", line 367, in get_
py2exe_datafiles
    mplfiles = glob.glob(os.sep.join([matplotlib.get_data_path(), '*']))
NameError: global name 'matplotlib' is not defined

This seems to be the code that you added to the __init__.py file:

  def get_py2exe_datafiles():
      import glob
    
      mplfiles = glob.glob(os.sep.join([matplotlib.get_data_path(), '*']))
      # Need to explicitly remove cocoa_agg files or py2exe complains
      mplfiles.remove(os.sep.join([matplotlib.get_data_path(), 'Matplotlib.nib']))
    
      return ('matplotlibdata', mplfiles)

I removed the matplotlib references and the code then worked:

  def get_py2exe_datafiles():
      import glob
    
      mplfiles = glob.glob(os.sep.join([get_data_path(), '*']))
      # Need to explicitly remove cocoa_agg files or py2exe complains
      mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib']))
    
      return ('matplotlibdata', mplfiles)

I can now create an .exe. I'll post soon as to how well the .exe actually works.

Thanks for your help.

Daniel
Oakland, CA

I fixed the matplotlib references. I must have been importing it in
my script. Thanks for the info.

- Charlie

···

On 3/17/06, Daniel McQuillen <danmcquillen@...9...> wrote:

Daniel McQuillen <daniel@...83...> writes:

> Charlie Moad <cwmoad <at> ...> writes:
>
> >
> > I just committed the changes to cvs and added a convenience function
> > for py2exe called get_py2exe_datafiles.
>

Charlie,

Thanks for your help. I tried running your script and got an error originating
from the function you wrote within __init__.py. I tried the function by itself
within PyShell and got the same error...here's the error I received:

  File "setup.py", line 23, in ?
    data_files = [('', ['nlo.gif', '../vtkrotate/NMA.pdb']),
  File "C:\Python24\Lib\site-packages\matplotlib\__init__.py", line 367, in get_
py2exe_datafiles
    mplfiles = glob.glob(os.sep.join([matplotlib.get_data_path(), '*']))
NameError: global name 'matplotlib' is not defined

This seems to be the code that you added to the __init__.py file:

  def get_py2exe_datafiles():
      import glob

      mplfiles = glob.glob(os.sep.join([matplotlib.get_data_path(), '*']))
      # Need to explicitly remove cocoa_agg files or py2exe complains
      mplfiles.remove(os.sep.join([matplotlib.get_data_path(), 'Matplotlib.nib']))

      return ('matplotlibdata', mplfiles)

I removed the matplotlib references and the code then worked:

  def get_py2exe_datafiles():
      import glob

      mplfiles = glob.glob(os.sep.join([get_data_path(), '*']))
      # Need to explicitly remove cocoa_agg files or py2exe complains
      mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib']))

      return ('matplotlibdata', mplfiles)

I can now create an .exe. I'll post soon as to how well the .exe actually works.

Thanks for your help.

Daniel
Oakland, CA

-------------------------------------------------------
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&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options