matplotlib and py2exe

I did reinstall my python with Python 2.5.1, Matplotlib 0.9, wxpython 2.8.4
and then it now works.
Best Regards

rfv-370 wrote:


I run on WinXP with
matplotlib 0.9.0
python 2.4.3 (enthought edition)

rfv-370 wrote:

Hello werner,

I tried your small example to use your setup and your simple_plot but i
get the following traceback:

Traceback (most recent call last):
  File "", line 6, in ?
  File "pylab.pyo", line 1, in ?
  File "matplotlib\pylab.pyo", line 203, in ?
  File "matplotlib\axes.pyo", line 16, in ?
  File "matplotlib\axis.pyo", line 19, in ?
  File "matplotlib\patches.pyo", line 42, in ?
  File "matplotlib\patches.pyo", line 79, in Patch
  File "matplotlib\cbook.pyo", line 352, in dedent
AttributeError: 'NoneType' object has no attribute 'splitlines'

Did I miss something?

Actually I am also trying to understand how to py2exe my own app.

Thanx for help.

Best Regards


Werner F. Bruhin wrote:

Hi Giorgio,

Had a quick look at pylab based scripts and got an error on
backend_tkagg when py2exe it. It looks like one needs to force the
backend to be included, I used tkagg but you would have to replace that
with wxagg for your script.

Attached is a and from the examples the file


# -*- coding: iso-8859-1 -*-#
from distutils.core import setup
import os
from os.path import join
import shutil

import glob
import py2exe
from py2exe.build_exe import py2exe
import sys

import matplotlib
mpdir, mpfiles = matplotlib.get_py2exe_datafiles()

# cleanup dist and build directory first (for new py2exe version)
if os.path.exists("dist/prog"):

if os.path.exists("dist/lib"):

if os.path.exists("build"):
# A program using wxPython

# The manifest will be inserted as resource into the .exe. This
# gives the controls the Windows XP appearance (if run on XP :wink:
manifest_template = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">


# options for py2exe
options = {"py2exe": {"compressed": 1,
                      "optimize": 2,
                      "packages": ["encodings",
"matplotlib.numerix", "matplotlib.backends.backend_tkagg"
                      "excludes": ["MySQLdb", ],
                      "dll_excludes": ["wxmsw26uh_vc.dll"]
zipfile = r"lib\"

class MetaBase:
    def __init__(self, **kw):
        self.version = '1.0' = "yourname"
        self.author_email = "name@...724..."
        self.company_name = ""
        self.copyright = "2003 - 2007 by whoever"
        self.url = ""
        self.download_url = ""
        self.trademark = ""
        self.comments = "a comment on the prog" = "the prog name"
        self.description = "a desc on the prog"

wx_emb = MetaBase(
            script = "",
            other_resources = [(RT_MANIFEST, 1, manifest_template %
dict(prog="your prog name"))],
## icon_resources = [(1, r"images/some.ico")],
            dest_base = r"prog\simple_plot")

      classifiers = ["Copyright:: your name",
                     "Development Status :: 5 Stable",
                     "Intended Audience :: End User",
                     "License :: Shareware",
                     "Operating System :: Microsoft :: Windows 2000",
                     "Operating System :: Microsoft :: Windows XP",
                     "Operating System :: Microsoft :: Windows 9x",
                     "Programming Language :: Python, wxPython",
                     "Topic :: Home Use"
                     "Natural Language :: German",
                     "Natural Language :: French",
                     "Natural Language :: English"],
      windows = [wx_emb],
      options = options,
      zipfile = zipfile,
      data_files = [("lib\\matplotlibdata", mpfiles),
## matplotlib.get_py2exe_datafiles(), # if you don't
use the lib option
#!/usr/bin/env python
Example: simple line plot.
Show how to make and save a simple line plot with labels, title and grid
from pylab import *

t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)
plot(t, s)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')



Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share
opinions on IT & business topics through brief surveys-and earn cash
Matplotlib-users mailing list

View this message in context:
Sent from the matplotlib - users mailing list archive at