app runs fine with interpreter, but not under py2exe

Doug Morse morse at edoug.org
Wed Mar 12 22:02:33 EDT 2008


Hi Harald and C.L.P.,

Precision.py is part of the Numeric package.  AFAIKT, the problem is during
the module initialization.  The first lines of Precision.py are:

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

Thanks again,
Doug


On Wed, 12 Mar 2008 03:09:59 -0700 (PDT), GHUM <haraldarminmassa at gmail.com>
wrote:
>  to my knowledge, "data type not understood" is a message not from core
>  Python, but rather thrown from "your" code. What is happening around
>  Precision.py, line 18?
> 
>  What does trigger that exception?
> 
>  My guess is, you are dealing with some custom imported modules which
>  define "data type"s.
>  (PIL does something similiar for supported images)... that is, some
>  module is trying to import all definitions from a specific directory.
> 
>  That "dynamic importing" fails within py2exe --- all the importing has
>  to be definit at py2exing-time. Please ready http://www.py2exe.org/
>  index.cgi/PIL_and_py2exe
>  and the other receipe on py2exe.org and try to adapt that knowledge to
>  your application.



More information about the Python-list mailing list