app runs fine with interpreter, but not under py2exe

Peter Otten __peter__ at web.de
Fri Mar 14 07:39:23 EDT 2008


Doug Morse wrote:

> from multiarray import zeros
> import string
> 
> typecodes = {'Character':'c', 'Integer':'1sil', 'UnsignedInteger':'bwu',
> 'Float':'fd', 'Complex':'FD'}
> 
> def _get_precisions(typecodes):
>     lst = []
>     for t in typecodes:
>         lst.append( (zeros( (1,), t ).itemsize()*8, t) )   <-- Line 18
>     return lst
> 
> def _fill_table(typecodes, table={}):
>     for key, value in typecodes.items():
>         table[key] = _get_precisions(value)
>     return table
> 
> _code_table = _fill_table(typecodes)
>
> I can't find any reason why line 18 is throwing a "data type not
> understood" error.  It doesn't seem to have anything to do with dynamic
> importing, but I can't be sure.  I would note that "zeros" is a built-in
> function found in the "python dll" multiarray.pyd (in the Numeric module
> directory).

I don't know why, but your module seems to use numpy's multiarray instead of
Numeric's:

>>> from multiarray import zeros
>>> zeros((1,), "1")
array([0], '1')
>>> from numpy.core.multiarray import zeros
>>> zeros((1,), "1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: data type not understood

Peter



More information about the Python-list mailing list