Problem using Jython in multiple sessions.

View: New views
1 Messages — Rating Filter:   Alert me  

Problem using Jython in multiple sessions.

by Prashant Golash :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi ,

I have a web application.I am having some python 2.5 files in .py format.
During build time, I use Jython 2.2 to convert these .py files into .class files and deploy it into tomcat.
These .class files are responsible for doing some conversion of input files during run time of the tool. (Jython 2.2 is used at run time also)
If I open up two sessions and start running the tool, only one file is getting converted and other is not getting converted at all,although some times it is converting properly.

My code snippet:

Properties preProperties, postProperties;
preProperties = System.getProperties();
postProperties = new Properties();
postProperties.setProperty("python.path", "knowledge-Base");
PythonInterpreter.initialize(preProperties, postProperties, new String[] { "-f","FileName" });
PythonInterpreter interp = new PythonInterpreter();


 //This is getting executed inside a loop for each input file

String path = getPath();
interp.exec("import sys");
interp.exec("sys.argv[1] = '" + path + "/InputFile+ "'");
//To change the Input file each time.
interp.execfile(new FileInputStream(new File("knowledge-Base"+/start_Project.py")))
;

All the class files are in the path knowledge-Base and there is one .py script start_Project.py which triggers the conversion and use other class files in the knowledge-Base.
Also if only one session is there and I give multiple input files then application runs successfully without any problem.
I am defining this code in session type of bean in Spring web flow.

Please have a look and see whether I am doing something wrong or the way I am using Jython has some problem.

Thanks,
Prashant

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users