Using Sage from C Python API

103 views
Skip to first unread message

Nicholas Roth

unread,
Feb 18, 2014, 12:31:04 PM2/18/14
to sage-s...@googlegroups.com
First off, I see no reason why this shouldn't be possible, since Sage just uses python anyway. Let me tell you what I'm doing and the error that I get:

I reference the same exact Python version that Sage uses from the sage/local/lib directory.

I tell python to pretend it's argv consists of a string with the full path to the sage binary in /local/bin.

I set the python home directory to /local.

Here's the error I get:
dlopen(/Library/WebServer/mod_sage/sage-6.1.1/local/lib/python2.7/lib-dynload/operator.so, 2): Symbol not found: __PyUnicodeUCS4_AsDefaultEncodedString Referenced from: /Library/WebServer/mod_sage/sage-6.1.1/local/lib/python2.7/lib-dynload/operator.so Expected in: flat namespace in /Library/WebServer/mod_sage/sage-6.1.1/local/lib/python2.7/lib-dynload/operator.so

Can you guys tell me what I'm doing wrong?

Jason Grout

unread,
Feb 18, 2014, 12:50:18 PM2/18/14
to sage-s...@googlegroups.com
Just to clarify: are you running Sage's python, or trying to run a
different python than the one compiled in Sage? If you want to run
python and import the sage library, you might consider doing:

sage -python myscript.py

Googling for PyUnicodeUCS4_AsDefaultEncodedString indicates that the
error shows up when python is compiled with different settings for the
--enable-unicode compile switch, for example,
https://www.rosettacommons.org/node/1901

Thanks,

Jason


Reply all
Reply to author
Forward
0 new messages