khalidh khalidh - 3 months ago 48
Ruby Question

An invalid interpreter was specified. (RubyPython::InvalidInterpreter)

My ruby code:-

require "rubypython"
RubyPython.start # start the Python interpreter
sys=RubyPython.import("pickle")
print sys.path
RubyPython.stop # stop the Python interpreter


Whe I run the command "
ruby rubypython.rb
" it gives an error

/var/lib/gems/2.3.0/gems/rubypython-0.6.3/lib/rubypython.rb:67:in `block in start':
An invalid interpreter was specified. (RubyPython::InvalidInterpreter)
from /var/lib/gems/2.3.0/gems/rubypython-0.6.3/lib/rubypython/python.rb:10:in `synchronize'
from /var/lib/gems/2.3.0/gems/rubypython-0.6.3/lib/rubypython/python.rb:10:in `synchronize'
from /var/lib/gems/2.3.0/gems/rubypython-0.6.3/lib/rubypython.rb:54:in `start'
from rubypython.rb:3:in `<main>'

Answer

I modified the file interpreter.rb from ~/.gem/ruby/2.3.0/gems/rubypython-0.6.3/lib/rubypython/interpreter.rb to open and edit the interpreter.rb file use nautilus command

if ::FFI::Platform::ARCH != 'i386'
   @locations << File.join("/opt/local/lib64", name)
   @locations << File.join("/opt/lib64", name)
   @locations << File.join("/usr/local/lib64", name)
   @locations << File.join("/usr/lib64", name)
   @locations << File.join("/usr/lib/x86_64-linux-gnu", name)

Added the @locations << File.join("/usr/lib/x86_64-linux-gnu", name) line at last . After this RubyPython.start returned true.