[SciPy-user] Weave.inline type conversion issue?

Anand Patil anand at soe.ucsc.edu
Fri Nov 10 11:21:38 CST 2006


Hi everyone, the following Python code:

        expr="""
       
        int i1;
       
        for(i1 = 0; i1 < N; i1++){
            //Nothing yet
        }
       
        """
        weave.inline(expr, ['N'],type_converters = converters.blitz)

produces:

<weave: compiling>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp: 
In function 'PyObject* compiled_func(PyObject*, PyObject*)':
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
error: ambiguous overload for 'operator<' in 'i1 < N'
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note: candidates are: operator<(int, int) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, float) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, double) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp: 
In function 'PyObject* compiled_func(PyObject*, PyObject*)':
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
error: ambiguous overload for 'operator<' in 'i1 < N'
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note: candidates are: operator<(int, int) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, float) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, double) <built-in>
lipo: can't figure out the architecture type of: /var/tmp//ccuaUHvY.out
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp: 
In function 'PyObject* compiled_func(PyObject*, PyObject*)':
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
error: ambiguous overload for 'operator<' in 'i1 < N'
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note: candidates are: operator<(int, int) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, float) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, double) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp: 
In function 'PyObject* compiled_func(PyObject*, PyObject*)':
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
error: ambiguous overload for 'operator<' in 'i1 < N'
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note: candidates are: operator<(int, int) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, float) <built-in>
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp:667: 
note:                 operator<(int, double) <built-in>
lipo: can't figure out the architecture type of: /var/tmp//ccuaUHvY.out
---------------------------------------------------------------------------
scipy.weave.build_tools.CompileError                              
Traceback (most recent call last)

This is where the traceback leaves my code:

--> 201                 weave.inline(expr, ['N'],type_converters = 
converters.blitz)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave/inline_tools.py 
in inline(code, arg_names, local_dict, global_dict, force, compiler, 
verbose, support_code, headers, customize, type_converters, 
auto_downcast, newarr_converter, **kw)
    336                                     customize=customize,
    337                                     type_converters = 
type_converters,
--> 338                                     auto_downcast = auto_downcast,
    339                                     **kw)
    340

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave/inline_tools.py 
in compile_function(code, arg_names, local_dict, global_dict, 
module_dir, compiler, verbose, support_code, headers, customize, 
type_converters, auto_downcast, **kw)
    445     # setting.  All input keywords are passed through to distutils
    446     mod.compile(location=storage_dir,compiler=compiler,
--> 447                 verbose=verbose, **kw)
    448
    449     # import the module and return the function.  Make sure

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave/ext_tools.py 
in compile(self, location, compiler, verbose, **kw)
    363         success = build_tools.build_extension(file, temp_dir = temp,
    364                                               compiler_name = 
compiler,
--> 365                                               verbose = verbose, 
**kw)
    366         if not success:
    367             raise SystemError, 'Compilation failed'

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave/build_tools.py 
in build_extension(module_path, compiler_name, build_dir, temp_dir, 
verbose, **kw)
    267         environ = copy.deepcopy(os.environ)
    268         try:
--> 269             setup(name = module_name, ext_modules = 
[ext],verbose=verb)
    270         finally:
    271             # restore state

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy/distutils/core.py 
in setup(**attr)
    172         new_attr['headers'] = []
    173
--> 174     return old_setup(**new_attr)
    175
    176 def _check_append_library(libraries, item):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/distutils/core.py 
in setup(**attrs)
    164                 raise
    165             else:
--> 166                 raise SystemExit, "error: " + str(msg)
    167
    168     return dist

CompileError: error: Command "c++ -arch ppc -arch i386 -isysroot 
/Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double 
-no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 
-I/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave 
-I/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/weave/scxx 
-I/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy/core/include 
-I/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4 -c 
/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.cpp 
-o 
/tmp/anand/python24_intermediate/compiler_af5eb7f7d8bab69813921c69a7e13082/Users/anand/.python24_compiled/sc_54201e8f7bd668d2944eb33b14c9fe9e0.o" 
failed with exit status 1


on my PowerBook G4, running Tiger and MacPython 2.4. What am I doing wrong?

Thanks in advance,
Anand


More information about the SciPy-user mailing list