File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
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 Java:
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
AttributeError when calling pyhton scripts from java class
How to call a Python method form Java class
Calling python function from java
Help - How to I tell java where my jython.py script is located in the Directory
Executing Jython script from java and accessing resulting object
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013