[Numpy-discussion] numpy and py2exe
Thu Aug 28 12:36:27 CDT 2008
An issue just came up with numpy and py2exe on the wxPython list. A
solution has been found, but I thought I'd post here, so that it could
be on the numpy developers' radar when considering the structure of
numpy for the future:
> I'm compile a wxPython script using GUI2Exe, and am getting the
> following when running the produced exe:
> $ ./dist/svm.exe
> Traceback (most recent call last):
> File "svm.py", line 28, in <module>
> import graphic_svm_data
> File "graphic_svm_data.pyo", line 29, in <module>
> File "floatcanvas\NavCanvas.pyo", line 7, in <module>
> File "floatcanvas\FloatCanvas.pyo", line 7, in <module>
> File "numpy\__init__.pyo", line 93, in <module>
> File "numpy\add_newdocs.pyo", line 9, in <module>
> File "numpy\lib\__init__.pyo", line 19, in <module>
> File "numpy\lib\financial.pyo", line 78, in <module>
> TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
> I tried to add numpy.lib.financial to the Excludes and Ignores list, but am still getting this error.
> Googling found that this problem is a known bug: http://article.gmane.org/gmane.comp.python.py2exe/2920
The solution was to:
> 2) Use Optimize=1 or Optimize=0 in GUI2Exe and re-build your
> executable. Uing Optimize=2 strips all docstrings in the executable,
> which may cause troubles (as in your case);
> [Ron Barak] YES!!!
> With Optimize=1 my script finally compiles to exe.
While this worked, I have a couple observations:
1) This broke on numpy.lib.financial. that had nothing to do with the
issue, but it would be nice if people could use numpy with py2exe and
the like without having to include all those unused packages. I think
this ties in with the discussion about speeding up with importing
process, and may be addressed in future versions if I understood the
results of some of the discussion at SciPy right.
2) it would also be nice if one could use numpy with the docstrings
removed, like in this case. I have no idea what the issues are with that.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the Numpy-discussion