How to tell GUI2Exe not to import numpy.lib.financial ?

Hi,

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
import graphic_svm_data
File “graphic_svm_data.pyo”, line 29, in
File “floatcanvas\NavCanvas.pyo”, line 7, in
File “floatcanvas\FloatCanvas.pyo”, line 7, in
File “numpy_init_.pyo”, line 93, in
File “numpy\add_newdocs.pyo”, line 9, in
File “numpy\lib_init_.pyo”, line 19, in
File “numpy\lib\financial.pyo”, line 78, in
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

Is there a way to tell GUI2Exe not to import the numpy.lib.financial module (which I don’t use) ?

Thanks,

Ron.

P.S.: running the script as a python script (svm.py) and not an exe, gives no problems.

Hi Ron,

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

Is there a way to tell GUI2Exe not to import the numpy.lib.financial module
(which I don't use) ?

You can try two or three different things:

1) Click the "Excludes" list control, hit Ctrl+A and edit the item to
be "numpy.lib.financial". I strongly doubt this will solve the issue,
as there are many other modules which use the very useful (!!!!)
technique of documenting things like this:

something.__doc__ += some_other_string

Which will break py2exe (and possibly all the other exe-builders out there).

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);

3) Use the bundle option with Bundle=2 or Bundle=3.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 8/28/08, Barak, Ron wrote:

···

From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: Thursday, 28 August, 2008 12:45
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] How to tell GUI2Exe not to import numpy.lib.financial ?

Hi Ron,
[Ron Barak] Hi Andrea,
On 8/28/08, Barak, Ron wrote:

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
import graphic_svm_data
File “graphic_svm_data.pyo”, line 29, in
**** > File “numpy\lib\financial.pyo”, line 78, in
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

Is there a way to tell GUI2Exe not to import the numpy.lib.financial
module (which I don’t use) ?

You can try two or three different things:

  1. Click the “Excludes” list control, hit Ctrl+A and edit the item to be “numpy.lib.financial”. I strongly doubt this will solve the issue, as there are many other modules which use the very useful (!!!) technique of documenting things like this:

something.doc += some_other_string

Which will break py2exe (and possibly all the other exe-builders out there).
[Ron Barak] As you suspected, this doesn’t work.

  1. 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.

  2. Use the bundle option with Bundle=2 or Bundle=3.

Andrea.
[Ron Barak] Thanks so much, Andrea, and I’ll be waiting for your next versions (where more icons on the right would be functional :slight_smile:

[Ron Barak] Bye,

Ron.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/