sorry..the program runs!

Fredrik Lundh effbot at telia.com
Wed Mar 15 16:52:11 CET 2000


nathan <nnever50 at yahoo.com> wrote:
> I cannot do anything with the GUI until the process is ended.
> There's other ways?

the posted solution works, unless you forgot to
change P_WAIT to P_NOWAIT.

if you cannot figure out how to do that, here's
a second example (also from the eff-bot guide)
which works on Windows only.  make sure you
call it as shown in the example:

# os-spawn-example-2.py

import os
import string

def run(program, *args, **kw):
    # find executable
    mode = kw.get("mode", os.P_WAIT)
    for path in string.split(os.environ["PATH"], os.pathsep):
        file = os.path.join(path, program) + ".exe"
        try:
            return os.spawnv(mode, file, (file,) + args)
        except os.error:
            pass
    raise os.error, "cannot find executable"

run("python", "hello.py", mode=os.P_NOWAIT)
print "goodbye"

## this prints:
##
## goodbye
## hello again, and welcome to the show

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list