compile, marshal, exec
"Fernando" <[email protected]>
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <1431338465815.11876.42688@webmail2> |
Hi,
I have a (internal) web app based on zope that uses many python scripts (essentially a function).
I am considering the porting of this application to Tomcat/Jython using pyservlet. In fact, there will be only one pyservlet which gets all requests and processes them according to type, one of this being a python script.
In Python, I could use the following code to process this scripts:
>>> f = file('dateGetYmd') # the script file, which has a namesake function
>>> obj = compile(f.read(), '', 'exec')
>>> marshal.dump(obj, fc)
>>> exec obj
>>> dateGetYmd('0') # this function call will also access local objects
Would this work in Jython? docs would say so, but is there any caveats?
and what about performance? what does compile return? (python byte codes?)
Or is there a better way to do it?
Regards,
Fernando Martins
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users