Threading and Windows.

J

Jorge Godoy

What is os.P_NOWAIT on your system? It looks like '1' (no quotes) on my system:

1

It is '1', just as in yours. I was saying that there's no 'P_NOWAIT'
(with quotes and no 'os.' prefix). :)
So one would think

os.spawnv(os.P_NOWAIT, 'c:/python22/pythonw.exe',
['c:/python22/pythonw.exe', 'another.py', parameter])

Exactly. In fact it ended up as (this is in a separate method on the
main program):

if (sys.platform == 'win32'):
python = 'c:/python22/pythonw.exe'
os.spawnv(os.P_NOWAIT, python, [python, program, parameter])
else:
os.spawnv(os.P_NOWAIT, program, [program, parameter])
would work, except I note that os.P_NOWAIT is not defined in Python 1.5.2 on Linux (slackware).
Gotta upgrade one of these days... My nt python is 2.3 though, but I don't suppose that's changed
since the 2.2 you are apparently running on windows??

I'm running 2.2 on both platforms and with the 'os.' prefix everything
worked. :)


Thanks,
 
T

Tim Evans

Jorge Godoy said:
[snip]...it ended up as (this is in a separate method on the main
program):

if (sys.platform == 'win32'):
python = 'c:/python22/pythonw.exe'
os.spawnv(os.P_NOWAIT, python, [python, program, parameter])
else:
os.spawnv(os.P_NOWAIT, program, [program, parameter])

You should probably just be using this on both systems:

os.spawnv(os.P_NOWAIT, sys.executable, [sys.executable, program, parameter])
 
J

Jorge Godoy

Tim Evans said:
Jorge Godoy said:
[snip]...it ended up as (this is in a separate method on the main
program):

if (sys.platform == 'win32'):
python = 'c:/python22/pythonw.exe'
os.spawnv(os.P_NOWAIT, python, [python, program, parameter])
else:
os.spawnv(os.P_NOWAIT, program, [program, parameter])

You should probably just be using this on both systems:

os.spawnv(os.P_NOWAIT, sys.executable, [sys.executable, program, parameter])

VERY interesting.

I think that with that I can avoid checkin the OS the software will be
running in.

Thanks.


See you,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,440
Latest member
YoungBorel

Latest Threads

Top