future import fails in loading external cython file

asked 2012-06-14 04:52:54 -0500

steve0123 gravatar image

updated 2012-06-14 04:56:11 -0500

I wrote a cython file in a text editor, MyProgram.pyx

I opened a new sage notebook, with one line:

load("/home/steve/blahblah/MyProgram.pyx")

When I ran it I got an error message...

Compiling /home/steve/blahblah/MyProgram.pyx...
Error compiling cython file:
Error converting /home/steve/blahblah/MyProgram.pyx to C:

Error compiling Cython file:
------------------------------------------------------------
...

include "cdefs.pxi"
"""
this is my docstring
"""
from __future__ import division
                              ^
------------------------------------------------------------

_home_steve_blahblah_MyProgram_pyx_1.pyx:9:31: from
__future__ imports must occur at the beginning of the file

Deleting the docstring -- so that "from __future__ import division" was the very first characters in the file -- did not help. Is this a bug or am I doing something stupid??

I'm using Sage Version 5.0, Release Date: 2012-05-14, on Ubuntu.

edit retag flag offensive close merge delete