Skip to content

matplotlib problem #71

@poettler-ric

Description

@poettler-ric

I am trying to package matplotlib with py2exe.

The matplotlib.get_py2exe_datafiles() function (from the wiki) in matplotlib doesn't exist any more, so I used the following code to assemble my data files:

import matplotlib as mpl
mpl_files = []
for e in os.walk(mpl.get_data_path()):
    for f in e[2]:
        mpl_files.append(os.path.join(e[0], f))

And add it with

...
setup(
    name="trainer",
    console=["start.py"],
    data_files=[
        ("mpl-data", mpl_files),
...

Which seems to create the necessary files.
But when I then execute the binary I get the following error:

<frozen zipimport>:259: MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.
Traceback (most recent call last):
  File "start.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "hydraulicstrainer\__init__.pyc", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "hydraulicstrainer\demo.pyc", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "matplotlib\__init__.pyc", line 914, in <module>
  File "matplotlib\cbook\__init__.pyc", line 480, in _get_data_path
  File "matplotlib\__init__.pyc", line 239, in wrapper
  File "matplotlib\__init__.pyc", line 534, in get_data_path
  File "matplotlib\__init__.pyc", line 239, in wrapper
  File "matplotlib\__init__.pyc", line 563, in _get_data_path
NameError: name 'defaultParams' is not defined

Did I miss something?

I am using py2exe version 0.10.2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions