[Numpy-discussion] a question about freeze on numpy 1.7.0
Bradley M. Froehle
Mon Feb 25 01:53:55 CST 2013
I can reproduce with NumPy 1.7.0, but I'm not convinced the bug lies within
The exception is not being raised on the `del sys` line. Rather it is
being raised in numpy.__init__:
line 27, in <module>
exec code in m.__dict__
File "numpytest.py", line 1, in <module>
147, in <module>
from core import *
AttributeError: 'module' object has no attribute 'sys'
This is because, somehow, `'sys' in numpy.core.__all__` returns True in the
cx_Freeze context but False in the regular Python context.
On Sun, Feb 24, 2013 at 10:49 PM, Gelin Yan <firstname.lastname@example.org> wrote:
> On Mon, Feb 25, 2013 at 9:16 AM, Ondřej Čertík <email@example.com>wrote:
>> Hi Gelin,
>> On Sun, Feb 24, 2013 at 12:08 AM, Gelin Yan <firstname.lastname@example.org> wrote:
>> > Hi All
>> > When I used numpy 1.7.0 with cx_freeze 4.3.1 on windows, I quickly
>> > found out even a simple "import numpy" may lead to program failed with
>> > following exception:
>> > "AttributeError: 'module' object has no attribute 'sys'
>> > After a poking around some codes I noticed /numpy/core/__init__.py has a
>> > line 'del sys' at the bottom. After I commented this line, and repacked
>> > whole program, It ran fine.
>> > I also noticed this 'del sys' didn't exist on numpy 1.6.2
>> > I am curious why this 'del sys' should be here and whether it is safe to
>> > omit it. Thanks.
>> The "del sys" line was introduced in the commit:
>> and it seems to me that it is needed so that the numpy.core namespace is
>> cluttered by it.
>> Can you post the full stacktrace of your program (and preferably some
>> how to reproduce the problem)? It should become clear where the problem
>> NumPy-Discussion mailing list
> Hi Ondrej
> I attached two files here for demonstration. you need cx_freeze to
> build a standalone executable file. simply running python setup.py build
> and try to run the executable file you may see this exception. This
> example works with numpy 1.6.2. Thanks.
> gelin yan
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion