简体   繁体   中英

Import rethinkdb python module in to use in Jython

I am trying to connect to rethink db(has a python driver) from my java app. RethinkDB python install section https://www.rethinkdb.com/docs/install-drivers/python/ does not have a place to explicitly download the python modules. Because for me, I am trying to use jython to connect and it fails with following

code:

 String s = "import rethinkdb as r\n" +
                "r.connect('localhost', 28015).repl()\n" +
                "r.table('tv_shows').insert({ 'name': 'Star Trek TNG' }).run()";

        PyCode code = python.compile(s);
        python.exec(code);
        System.out.println("Done..");

Error:

Exception in thread "main" Traceback (most recent call last): File "", line 1, in ImportError: No module named rethinkdb

Any idea on where can I get the rethinkdb module explicitly and how I can made it available to my Java app ? (assume to out that into class path)

The currently released Python driver is always up on PyPi, and you can download it directly from: https://pypi.python.org/pypi/rethinkdb

I am not a Jython user, so I can best direct you to this question about modules: How can I install various Python libraries in Jython?

I should also note that an official Java driver was recently released: http://rethinkdb.com/blog/official-java-driver/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM