[SciPy-user] strange weave.inline errors in weave using gcc3.2

Christopher Fonnesbeck chris at fonnesbeck.org
Sun Mar 30 23:10:36 EST 2003


I have installed weave from cvs, and with gcc3.2 all of the tests run 
fine. However, when I run it with some of my code, Bad Things happen. 
Here are the relevant parts of the code, followed by the error messages:

         code = '''
         #line 610 "ReinforcementLearning.py"

         PyObject *key, *qval, *traceval = NULL;
         Py::List keys = qfunction.keys();
         for (int i=0; i<keys.length(); i++) {
             key = PyList_GET_ITEM(keys.ptr(),i);

             /* Grab and convert current Q-value */
             qval = PyDict_GetItem(qfunction.ptr(),key);
             double qval_raw = py_to_float(qval,"qval_raw");

             /* Grab and convert current elegibility value */
             traceval = PyDict_GetItem(etrace.ptr(),key);
             double traceval_raw = py_to_float(traceval,"traceval_raw");

             /* Calculate new Q-value */
             qval_raw += alpha * delta * traceval_raw;

             /* Return new Q-value to Q-function */
             PyObject* qval_new = PyFloat_FromDouble(qval_raw);
             PyDict_SetItem( qfunction.ptr(),
               key, qval_new );

             /* Cleanup */
             Py_DECREF(qval_new);

             /* Only update nonzero e-trace values */
             if (traceval_raw>0.0) {

                 /* Only interested in sizeable values */
                 if (traceval_raw>=tolerance) {

                     /* Calculate new elegibility value */
                     traceval_raw = gamma * lamda * traceval_raw;

                     /* Return new elegibility value to trace */
                     PyObject* traceval_new = 
PyFloat_FromDouble(traceval_raw);
                     PyDict_SetItem( etrace.ptr(),
                       key, traceval_new );

                     /* Cleanup */
                     Py_DECREF(traceval_new);
                 }
                 /* Set very small values to zero */
                 else PyDict_SetItem( etrace.ptr(), key,
                   PyFloat_FromDouble(0.0) );
             }
        }
         '''

         'Call to weave'
         weave.inline(code,
                      ['qfunction',
                       'alpha','delta','etrace',
                       'gamma','lamda','tolerance'])

This yields:


ReinforcementLearning.py: In function `PyObject* compiled_func(PyObject*,
    PyObject*)':
ReinforcementLearning.py:612: `Py' undeclared (first use this function)
ReinforcementLearning.py:612: (Each undeclared identifier is reported 
only once
    for each function it appears in.)
ReinforcementLearning.py:612: parse error before `::' token
ReinforcementLearning.py:613: `keys' undeclared (first use this function)
ReinforcementLearning.py:617: no matching function for call to 
`py::dict::ptr()
    '
ReinforcementLearning.py:621: no matching function for call to 
`py::dict::ptr()
    '
ReinforcementLearning.py:629: no matching function for call to 
`py::dict::ptr()
    '
ReinforcementLearning.py:646: no matching function for call to 
`py::dict::ptr()
    '
ReinforcementLearning.py:653: no matching function for call to 
`py::dict::ptr()
    '
Traceback (most recent call last):
   File "ReinforcementLearning.py", line 931, in __call__
     s==maxsteps-1)
   File "ReinforcementLearning.py", line 678, in update_qfunction
     ['qfunction',
   File "/usr/lib/python2.2/site-packages/weave/inline_tools.py", line 
335, in inline
     auto_downcast = auto_downcast,
   File "/usr/lib/python2.2/site-packages/weave/inline_tools.py", line 
439, in compile_function
     verbose=verbose, **kw)
   File "/usr/lib/python2.2/site-packages/weave/ext_tools.py", line 340, 
in compile
     verbose = verbose, **kw)
   File "/usr/lib/python2.2/site-packages/weave/build_tools.py", line 
272, in build_extension
     setup(name = module_name, ext_modules = [ext],verbose=verb)
   File "/usr/lib/python2.2/site-packages/scipy_distutils/core.py", line 
42, in setup
     return old_setup(**new_attr)
   File "//usr/lib/python2.2/distutils/core.py", line 157, in setup
     raise SystemExit, "error: " + str(msg)
CompileError: error: command 'gcc' failed with exit status 1


Any ideas what is happening?

-- 
Christopher J. Fonnesbeck (chris at fonnesbeck.org)
GA Coop. Fish & Wildlife Research Unit, University of Georgia

Oh my friend, what a time is this
To trade the handshake for the fist
	-- Joni Mitchell




More information about the SciPy-User mailing list