Mailing List Archive

spawnv
I am trying to spawn c:\windows\notepad.exe from a Python program. I want
the python script to wait for Notepad to exit.
How can I do this?

I have tried all combinations I can think of using execv, spawn, system and
cannot get it to work.

Could someone please post the exact command sequence to type in.

Thanks in advance,
Craig Curtis
spawnv [ In reply to ]
Hi Craig,

This works on WIN95:

os.system(r"start /w c:\windows\notepad.exe")

It leaves a dos window displayed however. If you change the properties
of the dos window to minimized, the next time through it won't display.
I imagine it's possible to preset this, but I haven't tried. Does
anyone know how to stop this or get around it?

--

Emile van Sebille
emile@fenx.com
-------------------


Craig Curtis <c.curtis@worldnet.att.net> wrote in message
news:19990801171952.JFVG5731@default...
> I am trying to spawn c:\windows\notepad.exe from a Python program. I
want
> the python script to wait for Notepad to exit.
> How can I do this?
>
> I have tried all combinations I can think of using execv, spawn,
system and
> cannot get it to work.
>
> Could someone please post the exact command sequence to type in.
>
> Thanks in advance,
> Craig Curtis
>
>
spawnv [ In reply to ]
This worked for me on a project I did a couple of months ago. It did =
its thing for a couple of minutes then when it exited the Python script =
resumed.

...
import os
...
os.spawnv(os.P_WAIT, os.path.join(gmpath,'gmw4.exe'),
[r' /u:MASTER', r' /p:ACCESS', r' /r:69,5'])
...

spawnv (mode, path, args)=20
Execute the program path in a new process, passing the arguments =
specified in args as command-line parameters. args may be a list or a =
tuple. mode is a magic operational constant. See the Visual C++ Runtime =
Library documentation for further information. Availability: Windows. =
New in version 1.5.2.=20

P_WAIT=20
P_NOWAIT
P_NOWAITO
P_OVERLAY
P_DETACH
Possible values for the mode parameter to spawnv() and spawnve(). =
Availability: Windows. New in version 1.5.2.=20


Karl Putland
kperacles@geocities.com



Craig Curtis <c.curtis@worldnet.att.net> wrote in message =
news:19990801171952.JFVG5731@default...
> I am trying to spawn c:\windows\notepad.exe from a Python program. I =
want
> the python script to wait for Notepad to exit. =20
> How can I do this? =20
>=20
> I have tried all combinations I can think of using execv, spawn, =
system and
> cannot get it to work.
>=20
> Could someone please post the exact command sequence to type in.
>=20
> Thanks in advance,
> Craig Curtis
>=20
>=20