os.system()

Y

Yigit Turgut

When I use os.system() function, script waits for termination of the
windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?
 
J

Jacob MacDonald

When I use os.system() function, script waits for termination of the
windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?

You have to use threads. As in most programming languages (I believe), the program waits for a line to finish before moving on. So you'll have to create a new thread to deal with the windows, then move on to other stuff. Readthe docs on the threading modules.
 
S

Steve

"Yigit Turgut" wrote in message
When I use os.system() function, script waits for termination of the
windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?

Can you make use of subprocess.Popen() ?
 
Y

Yigit Turgut

windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?

Can you make use of subprocess.Popen() ?

Still waits for the new windows to kill.
 
A

Adam Skutt

Still waits for the new windows to kill.

It should not do so unless you tell it do so, but without more details
it's difficult to determine what is happening. The only waiting that
should be necessary is to eventually call Popen.poll() or Popen.wait()
to reap the subprocess after it terminates, but there are many correct
ways to do that depending on your application and the subprocess. A
thread, as suggested by Jacob, is one way to accomplish it.

Adam
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top