From: Josh J. <jun...@gm...> - 2011-05-28 13:48:38
|
Sorry I never got back to you, hope you were able to figure out this issue, or at least a workaround. I have never tried to use scripts that were included in an EAR file in my sys.path, so I really am not sure if that would work. I know that a JAR should work just fine...never tried an EAR myself though. Can't you unpack the JAR that is contained within the EAR file and put it in the sys.path? That should work, right? Are the scripts within a JAR file inside the EAR? Anyone else on the list ever tried to use PythonInterpreter to work with scripts that are packaged within an EAR? Thanks Josh Juneau jun...@gm... http://jj-blogger.blogspot.com http://www.jythonbook.com Oracle PL/SQL Recipes - http://www.apress.com/9781430232070 On Thu, May 26, 2011 at 2:19 PM, David Starr <sta...@ho...>wrote: > My scripts that I want to add to the sys.path are packaged in an EAR > file. Is that going to be an issue? > > pyInter.exec("import sys"); > String earPath = > AppProps.instance().getProperty(AppProps.KEY_CNS_EAR_PATH); > pyInter.set("earPath", earPath); > pyInter.exec("sys.path.append(earPath)"); > pyInter.exec("x = sys.path"); > PyObject sysPath = pyInter.get("x"); > pyInter.execfile("SendGridEnvelope.py"); > > any help would be greatly appreciated. This is killing me. > > Thanks, > David > > ------------------------------ > Date: Thu, 26 May 2011 11:27:50 -0500 > Subject: Re: [Jython-users] file not found when calling execfile function > From: jun...@gm... > To: sta...@ho... > > Sorry about that, meant to reply-all on that message. Good luck! > > Josh Juneau > jun...@gm... > http://jj-blogger.blogspot.com > http://www.jythonbook.com > Oracle PL/SQL Recipes - http://www.apress.com/9781430232070 > > > > > On Thu, May 26, 2011 at 11:11 AM, David Starr <sta...@ho...>wrote: > > thanks Josh, i will check it out. you're the man! > > ------------------------------ > Date: Thu, 26 May 2011 10:45:30 -0500 > Subject: Re: [Jython-users] file not found when calling execfile function > From: jun...@gm... > To: sta...@ho... > > David- > > Jython will look on your sys.path for the module. Therefore, you need to > be sure that SendGridEnvelope.py is somewhere on your sys.path. Please read > Chapter 8 of the Jythonbook for more information: > http://www.jython.org/jythonbook/en/1.0/ModulesPackages.html#module-search-path-and-loading > > Hope this helps! > > Josh Juneau > jun...@gm... > http://jj-blogger.blogspot.com > http://www.jythonbook.com > Oracle PL/SQL Recipes - http://www.apress.com/9781430232070 > > > > > On Thu, May 26, 2011 at 10:28 AM, dstarr <sta...@ho...>wrote: > > > 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 > > > > |