On Mar 4, 2011, at 9:40, Bill Janssen <[email protected]> wrote: > The number of patches to Tomcat make me uneasy. I was hoping to bundle > all this into a .war file containing a servlet which would use it with > an unmodified Tomcat. > > Does that seem possible?
No. The PythonVM must be initialized in the main thread and you have no control over that in Tomcat out of the box, apparently. > Also, what if I want to run a number of different Python programs? Can > I instantiate PythonVM more than once? No. The PythonVM is loaded in process as a shared library and there can only be one per process. In other words, only one PythonVM can be instantiated from that library in a given process. See docs about Py_Initialize(). Andi.. > Or if I need to run the same > Python program multiple times? There is no notion of python program in this context (no __main__). You import a module, instantiate a class from it and invoke its methods. You can import and instantiate as many classes and modules as you like, of course. Andi.. > > Bill
