A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
file not found when calling execfile function
Joined: May 23, 2011
May 23, 2011 00:26:08
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?
Joined: Aug 25, 2008
Jul 05, 2011 19:44:21
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(
I agree. Here's the link:
subject: file not found when calling execfile function
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015