I am new to both Python and Jython. I am just wondering if is possible to use Python to execute a Jython script and get its result.
The reason is the code was previously done by another person and I do not want to go changing or messing with every single thing that has compatibility issue with Jython. because I just need to pass some data to a Java class and receive its return result.
I try using subprocess but i kept getting a error stating (The system cannot find the file specified)
from subprocess import Popen, PIPE, STDOUT
p = Popen(['Jython', 'test.py'], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
Rachel Gallen
28.7k22 gold badges77 silver badges87 bronze badges
-
How do you run test.py with Jython from the command-line? Does it succeed?pts– pts2014年06月23日 08:41:57 +00:00Commented Jun 23, 2014 at 8:41
1 Answer 1
There are two possible problems here:
- change
Jythontojythonas the terminal/python are case sensitive. - specify the absolute path to your test script
'/{PATH TO TEST SCRPIT}/test.py'
answered Jun 23, 2014 at 8:24
cchristelis
2,0351 gold badge14 silver badges17 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py