rubypython and sage

asked 2013-11-03 08:16:12 +0100

warbot gravatar image

I would like to have a python back-end with ruby front-end. For that reason i'm using rubypython.

My question is: can I use sage with rubypython lib?

The example that did not work for me:
s.sage:

#!/usr/bin/env sage

a = 100020003000400050006000700080009000L

print "a = {0}".format(a)

sage s.sage # => s.py

r.rb:

require 'rubypython'

RubyPython.start

sys = RubyPython.import("sys")
sys.path.append("/Users/name/Documents") # path to s.py folder to import it
sys.path.append("#{ENV["SAGE_ROOT"]}")   # added in hope for the best

# added path to sage, otherwise => ImportError: No module named sage.all_cmdline
sys.path.append("/Applications/sage/devel/sage/build/lib.macosx-10.8-x86_64-2.7")

RubyPython.import 's'

Running the script:

ruby r.rb # =>
RubyPython::PythonError: ImportError: dlopen(/Applications/sage/devel/sage/build/lib.macosx-10.8-x86_64-2.7/sage/ext/c_lib.so, 2): Library not loaded: libcsage.dylib
  Referenced from: /Applications/sage/devel/sage/build/lib.macosx-10.8-x86_64-2.7/sage/ext/c_lib.so
  Reason: image not found
  import at /Users/name/.rvm/gems/jruby-1.7.6/gems/rubypython-0.6.3/lib/rubypython.rb:107
  (root) at iruby.rb:18
edit retag flag offensive close merge delete