Desmond
Desmond

Reputation: 45

Python script executing Jython script

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)

Upvotes: 1

Views: 404

Answers (1)

cchristelis
cchristelis

Reputation: 2015

There are two possible problems here:

  • change Jython to jython as the terminal/python are case sensitive.
  • specify the absolute path to your test script '/{PATH TO TEST SCRPIT}/test.py'

Upvotes: 2

Related Questions