Reputation: 3
I am programming in Python(2.7), processing a bunch of data. And I've got a software, what I have to use, and I want to start it automatically, and fill it up with data.
The problem is, that I cant open it with Python, because it has API only for Jython.
My question is, that how could I run a Jython script from a Python code(actually I am working on a standalone software)? Is it even possible?
If it is, could you please give me a short example? How to install Jython and how to run a file from python?
Upvotes: 0
Views: 1730
Reputation: 54302
You can simply use Jython to run everything.
Having my_script.py
and jython_script.py
edit my_script.py
by adding import jython_script
and adding call jython_script.some_function()
.
# my_script.py
import jython_script
def my_function_using_some_function_from_jython_script():
...
jython_script.some_function()
...
Then simply call:
jython my_script.py
I assume you do not use modules that work only with CPython.
Upvotes: 2