afaik this is a problem with the Sage notebook. Try to Cythonize from the 
command line, and if that works, take it to the Sage list.

Dag Sverre Seljebotn
-----Original Message-----
From: "Glenn Tarbox, PhD" <[email protected]>
Date: Saturday, Jun 6, 2009 6:01 am
Subject: [Cython] Trivial numpy test in sage notebook fails...
To: [email protected]: [email protected]

Here's the code which is the first cell of a sage notebook (sage 4.0)
>
>%cython
>import numpy as np
>cimport numpy as np
>DTYPE = np.int
>ctypedef np.int_t DTYPE_t
>
>Here's the error:
>
>Traceback (most recent call last):    DTYPE = np.int
>  File 
> '/mnt/hdd/sage/sage-4.0/local/lib/python2.5/site-packages/sage/server/support.py',
>  line 408, in cython_import_all
>    create_local_c_file=create_local_c_file)
>  File 
> '/mnt/hdd/sage/sage-4.0/local/lib/python2.5/site-packages/sage/server/support.py',
>  line 385, in cython_import
>    create_local_c_file=create_local_c_file)
>  File 
> '/mnt/hdd/sage/sage-4.0/local/lib/python2.5/site-packages/sage/misc/cython.py',
>  line 367, in cython
>    raise RuntimeError, 'Error converting %s to C:\n%s\n%s'%(filename, log, 
> err)
>RuntimeError: Error converting 
>/home/tarbox/.sage/sage_notebook/worksheets/admin/89/code/sage23.spyx to C:
>
>
>Error converting Pyrex file to C:
>------------------------------------------------------------
>...
>
>include 'cdefs.pxi'
>import numpy as np
>cimport numpy as np
>DTYPE = np.int
> ctypedef np.int_t DTYPE_t        ^
>------------------------------------------------------------
>
>/home/tarbox/.sage/temp/hq2/12471/spyx/_home_tarbox__sage_sage_notebook_worksheets_admin_89_code_sage23_spyx/_home_tarbox__sage_sage_notebook_worksheets_admin_89_code_sage23_spyx_0.pyx:9:9:
> 'int_t' is not a type identifier 
>I tried with and without the 'import numpy' directive thinking it may be 
>redundant...
>
>This example comes from the 'cython for numpy users' tutorial on the wiki 
>where it mentions that all numpy types have a corresponding _t type
>
>There is indeed a numpy.int type... so I was wondering if the new work with 
>python buffers changed how things work.
>
>-glenn
>
>-- 
>Glenn H. Tarbox, PhD ||  206-274-6919
>http://www.tarbox.org
>

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to