I’ve just started working with RubyPython, and though the documentation says you can load modules, it doesn’t have any examples or directions to do that.
I’ve got Python NLTK installed on my machine (Ubuntu if it matters), and can import the module when running Python from the command line.
However, I’m under the impression that the RubyPython gem installs another version of Python which the gem interacts with from Ruby (though I could be wrong).
Is there a different folder I need to install NLTK to, or something else I need to do to access NLTK from Ruby through RubyPython?
I have confirmed that RubyPython itself is loading into Rails code properly.
The code I’m running is just
RubyPython.start
import nltk
RubyPython.stop
and I get
undefined local variable or method `nltk'
I can’t create the tag RubyPython which is why this article isn’t tagged as such.
The correct syntax is:
also you can specify which Python interpreter you want to use by doing: