[SciPy-user] example dict_sort.py compile error

Chuckles McGregor chuckles at llnl.gov
Wed Apr 26 13:12:51 CDT 2006


good day,
	I'm trying to run the dict_sort.py script from the weave/examples dir
and at this piece of the script:

def c_sort2(adict):
     assert(type(adict) is dict)
     code = """
            #line 44 "dict_sort.py"
            py::list keys = adict.keys();
            py::list items(keys.len());
            keys.sort();
            int N = keys.length();
            for(int i = 0; i < N;i++)
               items[i] = adict[keys[i]];
            return_val = items;
            """
     return inline_tools.inline(code,['adict'],verbose=1)

I'm getting this error from the compiler:

dict_sort.py(49) : error C2593: 'operator [' is ambiguous
         C:\Python24\Lib\site-packages\scipy\weave\scxx/dict.h(120): could 
be 'py
::object::keyed_ref py::dict::operator [](const std::string &)'
         C:\Python24\Lib\site-packages\scipy\weave\scxx/dict.h(113): or 
'py::obje
ct::keyed_ref py::dict::operator [](const char *)'
         C:\Python24\Lib\site-packages\scipy\weave\scxx/dict.h(105): or 
'py::obje
ct::keyed_ref py::dict::operator [](const std::complex<double> &)'
         C:\Python24\Lib\site-packages\scipy\weave\scxx/dict.h(101): or 
'py::obje
ct::keyed_ref py::dict::operator [](double)'
         C:\Python24\Lib\site-packages\scipy\weave\scxx/dict.h(97): or 
'py::objec
t::keyed_ref py::dict::operator [](int)'
         while trying to match the argument list '(py::dict, py::indexed_ref)'
Traceback (most recent call last):
   File "dict_sort.py", line 119, in ?
     sort_compare(a,n)
   File "dict_sort.py", line 96, in sort_compare
     b=c_sort2(a)
   File "dict_sort.py", line 52, in c_sort2
     return inline_tools.inline(code,['adict'],verbose=1)
   File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 
334, in
  inline
     auto_downcast = auto_downcast,
   File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 
442, in
  compile_function
     verbose=verbose, **kw)
   File "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py", line 353, 
in co
mpile
     verbose = verbose, **kw)
   File "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py", line 
274, in
build_extension
     setup(name = module_name, ext_modules = [ext],verbose=verb)
   File "C:\Python24\Lib\site-packages\numpy\distutils\core.py", line 85, 
in setu
p
     return old_setup(**new_attr)
   File "C:\Python24\lib\distutils\core.py", line 166, in setup
     raise SystemExit, "error: " + str(msg)
distutils.errors.CompileError: error: Command "cl.exe /c /nologo /Ox /MD 
/W3 /EHsc /DNDEBUG -IC:\Python24\Lib\site-packages\scipy\weave 
-IC:\Python24\Lib\site-p
ackages\scipy\weave\scxx -IC:\python24\lib\site-packages\numpy\core\include 
-IC:
\python24\include -IC:\python24\PC 
/Tpc:\docume~1\mcgreg~1\locals~1\temp\mcgrego
r1\python24_compiled\sc_9fef7eb8a0d63221b946305b186f457b1.cpp 
/Foc:\docume~1\mcg
reg~1\locals~1\temp\mcgregor1\python24_intermediate\compiler_d41d8cd98f00b204e98
00998ecf8427e\Release\docume~1\mcgreg~1\locals~1\temp\mcgregor1\python24_compile
d\sc_9fef7eb8a0d63221b946305b186f457b1.obj /Zm1000" failed with exit status 2

I'm using python 2.4.3, scipy 0.4.8, and the visual C++ express edition 
(ver 8) compiler. any suggestions?

chuckles



More information about the SciPy-user mailing list