Problem to access C code

3 views
Skip to first unread message

bourba

unread,
Mar 30, 2008, 3:44:39 PM3/30/08
to sage-support
Hello.

I would like to access external C code so I have
exactly followed the example exposed in
http://www.sagemath.org/doc/html/tut/node51.html
(5.2.1 Accessing C Functions in Separate Files)

My directory "/home/mainuser/test_sage" contains
"test.c" plus "test.spyx" and when I type :

sage : load "/home/mainuser/test_sage/test.spyx"

then sage returns this error message:

Loading of file "/home/mainuser/test_sage/test.spy" has type not
implemented.

Thanks.

Mike Hansen

unread,
Mar 30, 2008, 4:31:34 PM3/30/08
to sage-s...@googlegroups.com
Hello,

What version of Sage are you using? I tried this on my local machine
and can't duplicate the error that you're getting.

--Mike

William Stein

unread,
Mar 30, 2008, 4:37:54 PM3/30/08
to sage-s...@googlegroups.com
On Sun, Mar 30, 2008 at 12:44 PM, bourba <poloh...@hotmail.com> wrote:
>

Try changing the filename to test.pyx and see if that helps.

William

bourba

unread,
Mar 30, 2008, 6:15:57 PM3/30/08
to sage-support


On 30 mar, 22:37, "William Stein" <wst...@gmail.com> wrote:
1) I have renamed the file to test.pyx and now SAGE returns :

Syntax Error:
load "/home/mainuser/test_sage/test.pyx"

2) I use SAGE 2.10.4 (i686 athlon Debian)

bourba

unread,
Apr 3, 2008, 7:15:39 AM4/3/08
to sage-support
I've upgraded to 2.11.
I still get the same symptom while
sage runs on notebook mode *but*
when I launch SAGE on console the example
given by the tutorial works fine (with the .spyx
extension.) I can't see the link between
the notebook-interface causing problem when
cython is simultaneously working...

Is it possible to increase the verbosity
of the error message ?

Thanks.

Roger

unread,
Apr 8, 2008, 8:40:47 PM4/8/08
to sage-support
I have the same problem, I have not tried the SAGE on the console.
I also want to do the same. Have you managed to solve the problem?

Thanks

Roger,

On Apr 3, 4:15 am, bourba <polohora...@hotmail.com> wrote:
> On 31 mar, 00:15, bourba <polohora...@hotmail.com> wrote:
>
>
>
>
>
> > On 30 mar, 22:37, "William Stein" <wst...@gmail.com> wrote:
>
> > > On Sun, Mar 30, 2008 at 12:44 PM, bourba <polohora...@hotmail.com> wrote:
>
> > > >  Hello.
>
> > > >  I would like to access externalCcodeso I have
> > > >  exactly followed the example exposed in
> > > >  http://www.sagemath.org/doc/html/tut/node51.html
> > > >  (5.2.1 AccessingCFunctions in Separate Files)
>
> > > >  My directory "/home/mainuser/test_sage" contains
> > > >  "test.c" plus "test.spyx" and when I type :
>
> > > >  sage : load "/home/mainuser/test_sage/test.spyx"
>
> > > >  then sage returns this error message:
>
> > > >  Loading of file "/home/mainuser/test_sage/test.spy" has type not
> > > >  implemented.
>
> > > Try changing the filename to test.pyx and see if that helps.
>
> > > William
>
> > 1) I have renamed the file to test.pyx and now SAGE returns :
>
> > Syntax Error:
> >     load "/home/mainuser/test_sage/test.pyx"
>
> > 2) I use SAGE 2.10.4 (i686 athlon Debian)
>
> I've upgraded to 2.11.
> I still get the same symptom while
> sage runs on notebook mode *but*
> when I launch SAGE on console the example
> given by the tutorial works fine (with the .spyx
> extension.) I can't see the link between
> the notebook-interface causing problem when
> cython is simultaneously working...
>
> Is it possible to increase the verbosity
> of the error message ?
>
> Thanks.- Hide quoted text -
>
> - Show quoted text -

Simon King

unread,
Apr 9, 2008, 3:03:35 AM4/9/08
to sage-support
Dear Roger, dear bourba

On 9 Apr., 02:40, Roger <rpi...@gmail.com> wrote:
> I have the same problem, I have not tried the SAGE on the console.

Same for me: The console is fine, but the notebook doesn't work.

Two observations:
- Tab completion did not work in the notebook. When i entered
attach "/home/king/SAGE/te
and hit the tab-key, no completion (test.c or test.spyx) has been
suggested, although this works on the console
- The complaint is
Loading of file "/home/king/SAGE/test.spy" has type not implemented.
Note that it says "test.spy", not "test.spyx". As much as i remember,
there was a discussion on this in another thread.

I don't know if the two observations are related.

Yours
Simon

bourba

unread,
Apr 10, 2008, 6:38:36 AM4/10/08
to sage-support
-> to Roger.

No. Unfortunately, I'm stuck.
I stay on console as an (uncomfortable)
workaround to use my C code.

William Stein

unread,
Apr 10, 2008, 8:26:53 PM4/10/08
to sage-s...@googlegroups.com
On Wed, Apr 9, 2008 at 12:03 AM, Simon King <ki...@mathematik.uni-jena.de> wrote:
>
> Dear Roger, dear bourba
>
>
> On 9 Apr., 02:40, Roger <rpi...@gmail.com> wrote:
> > I have the same problem, I have not tried the SAGE on the console.
>
> Same for me: The console is fine, but the notebook doesn't work.
>
> Two observations:
> - Tab completion did not work in the notebook. When i entered
> attach "/home/king/SAGE/te
> and hit the tab-key, no completion (test.c or test.spyx) has been
> suggested, although this works on the console

This is not implemented. In fact, I never even thought of implementing this,
but it probably wouldn't be too hard.

> - The complaint is
> Loading of file "/home/king/SAGE/test.spy" has type not implemented.
> Note that it says "test.spy", not "test.spyx". As much as i remember,
> there was a discussion on this in another thread.

The problem is that I never implemented this. I wish somebody would.
I bet it would be very easy, since we have %cython in the notebook.
In fact, it just occured to me that if you type

cython(open("/home/king/SAGE/test.spyx").read())

then that is 100% equivalent to what you would get from

load /home/king/SAGE/test.spyx

So, it's pretty easy to workaround that load thing not being implemented!

>
> I don't know if the two observations are related.

They are, where the relationship is just me not having
implemented something I should have.

> >
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Reply all
Reply to author
Forward
0 new messages