I am trying to run Example 2: And getting following error. Please help me. abc@Math-Sans:~/Desktop$ gcc -I/usr/include/python2.7 ABC.c -lpython2.7 -lm -lutil -lpthread -ldl abc@Math-Sans:~/Desktop$ ./a.out 1+1: 2 Load sage Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named sage.all Factor 2310: Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'factor' is not defined
On Tuesday, September 13, 2011 at 9:16:05 PM UTC+5:30, Michael Rubinstein wrote: > > > I tried adding PySys_SetArgv(argc, argv); after Py_Initialize(); > It gets me further but then gives a strange error message: > > Loading the Sage library... > > > ------------------------------------------------------------ > Unhandled SIGSEGV: A segmentation fault occurred in Sage. > This probably occurred because a *compiled* component > of Sage has a bug in it (typically accessing invalid memory) > or is not properly wrapped with _sig_on, _sig_off. > You might want to run Sage under gdb with 'sage -gdb' to debug this. > Sage will now terminate (sorry). > ------------------------------------------------------------ > > > > > On Sep 13, 2:32 pm, Willem Jan Palenstijn <[email protected]> wrote: > > On Tue, Sep 13, 2011 at 06:10:45AM -0700, Michael Rubinstein wrote: > > > Example 2 > > > ---------------- > > > > > Next thing I tried to do was to embed sage in a c program, by > > > following > > >http://docs.python.org/extending/embedding.html > > > but that gave me errors at runtime. > > > > > For example, the following embed.c progam produced the output/errors > at the > > > bottom of this post. Any ideas what's wrong? Any ideas of better ways > to call > > > sage from within c or c++? > > > > Some quick googling suggests you may have to call PySys_SetArgv[Ex] ( > http://docs.python.org/c-api/init.html#PySys_SetArgvEx) to set up > sys.argv > > after calling Py_Initialize(). I haven't actually tried it, though. > > > > -Willem Jan -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
