Re: compile, marshal, exec

"Fernando" <[email protected]>
Newsgroups gmane.comp.lang.jython.user
Message-ID <1431362906679.72828.888@webmail4>
'import' is not so practical or nice. I have plenty of scripts in many directories, I don't want to litter them with __init__.py plus all the compiled files. I would prefer a single cache folder.

So far pyservlet seems enough for me, all I need is the doPost method.

I'll look into modjy but I don't fully get WSGI. How does modjy know which is the app to be called?

And can modjy keep an app loaded all the time waiting for requests?


On 11 May 2015, Alan Kennedy <[email protected]> wrote:
> [Fernando]
> > I am using pyservlet to call my own jython servlet and in here
> > I would run the code above. I don't see the need for extra
> > interpreters, right?
> 
> PythonInterpreter are really just thin wrappers around a PySystemState. PySystemState is the object that varies the interpreter environment, such as modules loaded, search paths, etc. So one Interpretet should be just fine.
> 
> [Fernando]
> > thks, I looked at it already but I don't have experience
> > with java and its libraries. If I get a decently working
> > solution then I could look into porting my jython servlet
> > to java, but I am really not looking forward to it.
> > For now I am merely seeing if there is any major roadblock.
> 
> I see no major roadblocks.
> 
> As for experience with java, you may find the java component of modjy a lot simpler to understand than PyServlet: it does all of the key things you need to do, but in a lot less code, and is much easier to read.
> 
> <https://hg.python.org/jython/file/376c6130d9e8/src/com/xhaus/modjy/ModjyJServlet.java>
> 
> [Fernando]
> > The reason for 'compile' is to persist the byte code for a quicker startup.
> > Sadly, marshall in jython does not seem to be working well.
> 
> If you import your code from a module instead of exec'ing it, and the process you're executing has write permission on the directory containing the imported module, jython will cache the JVM bytecode for your module, to speed up future execution.
> 
> For example, if your code is in "mymodule.py", when you "import mymodule", the JVM bytecode will be stored in a file called "mymodule$py.class" in the same directory.
> 
> You can see this in action by simply importing a module from the command line interpreter.
> 
> Alan.
> 
>

------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.