From: dstarr <sta...@ho...> - 2011-05-26 16:26:59
|
thanks David, i'll give it a try. David Handy-3 wrote: > > I'll give a wild guess, others can correct me if I'm wrong. > > The execfile() method is looking in the Jboss/bin directory because that > is the current directory for the JVM that is running JBoss. > I don't think you can change the current working directory of your running > JBoss. > > One possible solution to your problem: > > InputStream inStr = > this.getClass().getClassLoader().getResourceAsStream("SendGridEnvelope.py"); > pyInter.execfile(inStr, "SendGridEnvelope.py"); > > (I checked, and there is a PythonInterpreter.execfile() method that takes > an InputStream and a name as a parameter. The name is probably only used > in stack traces, etc., not to locate the file.) > > >> -----Original Message----- >> From: dstarr [mailto:sta...@ho...] >> Sent: Thursday, May 26, 2011 11:29 AM >> To: jyt...@li... >> Subject: [Jython-users] file not found when calling execfile function >> >> >> Hi, >> I am trying to execute the following code from Java: >> >> PythonInterpreter pyInter = new PythonInterpreter(); >> pyInter.execfile("SendGridEnvelope.py"); >> >> 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? >> >> Thanks, >> David >> -- >> View this message in context: http://old.nabble.com/file-not-found-when- >> calling-execfile-function-tp31703044p31703044.html >> Sent from the jython-users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> vRanger cuts backup time in half-while increasing security. >> With the market-leading solution for virtual backup and recovery, you get >> blazing-fast, flexible, and affordable data protection. >> Download your free trial now. >> http://p.sf.net/sfu/quest-d2dcopy1 >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users > > > > ------------------------------------------------------------------------------ > vRanger cuts backup time in half-while increasing security. > With the market-leading solution for virtual backup and recovery, > you get blazing-fast, flexible, and affordable data protection. > Download your free trial now. > http://p.sf.net/sfu/quest-d2dcopy1 > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > -- View this message in context: http://old.nabble.com/file-not-found-when-calling-execfile-function-tp31703044p31709651.html Sent from the jython-users mailing list archive at Nabble.com. |