Register / Login
Win a copy of
Think Java: How to Think Like a Computer Scientist
this week in the
Java in General
file not found when calling execfile function
posted 5 years ago
I am trying to execute the following code from
PythonInterpreter pyInter = new PythonInterpreter(); pyInter.execfile("SendGridEnvelope");
I have a python script called SendGridEnvelope.py that gets packaged in my WAR under WEB-INF/classes.
I keep getting a file not found exception because the execfile function is looking for the Python script under my Jboss/bin directory. I am using Jython by the way.
Does anyone know why the execfile method is looking for the python script in the Jboss/bin dir and how to change this?
posted 4 years ago
arg0)' searches the current working directory, you need to specify the absolute path and I always add the extension (.py)...
you could open the file as a
and pass it to 'execfile(
Calling python function from java
How to call a Python method form Java class
AttributeError when calling pyhton scripts from java class
Executing Jython script from java and accessing resulting object
Help - How to I tell java where my jython.py script is located in the Directory