Re: Running another python interpreter

2007-10-20 Thread Simon Pickles
This is very nearly perfect. I have a second console window. 
Unfortunately, the first is waiting for the second to close. Is there 
anyway to specify the equivalent of os.P_NOWAIT?

Gabriel Genellina wrote:
 --- Simon Pickles [EMAIL PROTECTED] escribió:

   
 os.spawnl(os.P_NOWAIT, sys.executable,
 sys.executable, gateway.py)
 ... works but both process output to the same
 interpreter window. Is there a way to run another
 interpreter window containing gateway.py?
 

 Use the subprocess module, passing CREATE_NEW_CONSOLE into creationflags:

 subprocess.call([sys.executable, gateway.py, other, arguments],
  creationflags = subprocess.CREATE_NEW_CONSOLE)

   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running another python interpreter

2007-10-20 Thread Gabriel Genellina
En Sat, 20 Oct 2007 06:12:23 -0300, Simon Pickles [EMAIL PROTECTED]  
escribi�:

 This is very nearly perfect. I have a second console window.
 Unfortunately, the first is waiting for the second to close. Is there
 anyway to specify the equivalent of os.P_NOWAIT?

Use the more generic version:

subprocess.Popen([sys.executable, gateway.py, other, arguments],  
creationflags = subprocess.CREATE_NEW_CONSOLE)

For more info on the subprocess module, see  
http://docs.python.org/lib/module-subprocess.html

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Running another python interpreter

2007-10-19 Thread Gabriel Genellina

--- Simon Pickles [EMAIL PROTECTED] escribió:

 os.spawnl(os.P_NOWAIT, sys.executable,
 sys.executable, gateway.py)
... works but both process output to the same
 interpreter window. Is there a way to run another
 interpreter window containing gateway.py?

Use the subprocess module, passing CREATE_NEW_CONSOLE into creationflags:

subprocess.call([sys.executable, gateway.py, other, arguments],
 creationflags = subprocess.CREATE_NEW_CONSOLE)

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Running another python interpreter

2007-10-18 Thread Simon Pickles
Hello,

I have several servers which link to each other (and of course, to clients).

At present, I am starting them in turn manually. Is there a way with 
python to say, open gateway.py in a new interpreter window?

I looked at execv, etc, but they seem to replace the current process. 
Ah, maybe I need spawnv().

I am on windows i386, python 2.5

Thanks

si
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running another python interpreter

2007-10-18 Thread Simon Pickles
Well, I tried:
   
os.spawnv(os.P_NOWAIT, gateway.py, ())

and got:

OSError: [Errno 8] Exec format



Simon Pickles wrote:
 Hello,

 I have several servers which link to each other (and of course, to clients).

 At present, I am starting them in turn manually. Is there a way with 
 python to say, open gateway.py in a new interpreter window?

 I looked at execv, etc, but they seem to replace the current process. 
 Ah, maybe I need spawnv().

 I am on windows i386, python 2.5

 Thanks

 si
   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running another python interpreter

2007-10-18 Thread Sushant
Does gateway.py has the python interpreter in the top (i.e., 
#!/usr/local/bin/python)

-Sushant.
On Thursday 18 October 2007 2:13 pm, Simon Pickles wrote:
 Well, I tried:

 os.spawnv(os.P_NOWAIT, gateway.py, ())

 and got:

 OSError: [Errno 8] Exec format

 Simon Pickles wrote:
  Hello,
 
  I have several servers which link to each other (and of course, to
  clients).
 
  At present, I am starting them in turn manually. Is there a way with
  python to say, open gateway.py in a new interpreter window?
 
  I looked at execv, etc, but they seem to replace the current process.
  Ah, maybe I need spawnv().
 
  I am on windows i386, python 2.5
 
  Thanks
 
  si
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running another python interpreter

2007-10-18 Thread Gabriel Genellina
On 18 oct, 16:55, Sushant [EMAIL PROTECTED] wrote:

 Does gateway.py has the python interpreter in the top (i.e.,
 #!/usr/local/bin/python)

The OP said he's on Windows so that doesn't matter.

 On Thursday 18 October 2007 2:13 pm, Simon Pickles wrote:

  os.spawnv(os.P_NOWAIT, gateway.py, ())

Try with:

os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, gateway.py)

or use the subprocess module.

--
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list