Multiple simultaneous Python interpreters

William Park opengeometry at yahoo.ca
Wed Mar 19 19:11:06 EST 2003


"White Flame \(aka David Holz\)" <whiteflame52 at y.a.h.o.o.com> wrote:
> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:3E78C112.48015ABE at engcorp.com...
>> Perhaps you're overestimating your need for independence in the multiple
>> instances?  Have you considered whether that's absolutely necessary for
>> your design?
> 
> Yes, it is absolutely necessary.  Independence is crucial for the ability to
> kill off and clean up a runaway script (ie, one that is adding elements to a
> dictionary in an infinite loop) without taking down the application or other
> simultaneously running scripts.  Plus, various interpreters should have
> different import functionality available to them, giving various "sandbox"
> models.  These are 2 fundamental points to the design.


1.  If you want independent 10 Python processes, then
	python script1.py &
	...
	python script10.py &
    will give you 10 Python processes, each with totally independent
    environment.

2.  How will you determine if a process is in infinite loop?  Will it
    "check-in" time to time, and if it doesn't, then you'll kill it?

3.  If you want to start off in Python, then when time comes to invoke a
    new Python process, then you can do
	os.system("python ... &")

4.  You can start off in shell script, and invoke Python whenever you
    feel like, 
	python script.py &

5.  If you want the child Python process to inherent the same
    environment as the parent Python process (much like shell forking a
    subshell), then embedded Python in a shell will do that.  In that
    case, when you fork a Python process, the child will inherent all
    the variables of the parent.

    I've posted a patch to Bash-2.05b to fully embed Python.  Search
    Google for '(patch for Bash) ...' subject.  It should be either in
    <comp.lang.python> or <comp.unix.shell>.

Your post is too vague.  Repost with concrete examples.

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
Linux solution for data management and processing. 




More information about the Python-list mailing list