subprocess in Command promt+ webbrowser

S

shanti bhushan

I have a code ,in which i invoke the local webserver in back
ground ,then open URL and access the web page.
below is my code.
I am able to invoke and kill the local webserver in seperate python
script,but when i club opening of browser and and subprocess , my like
below ,then my script is not responding.
Please guide me.

import subprocess
import time
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New2\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")
 
S

shanti bhushan

I have a code ,in which i invoke the local webserver in back
ground ,then open URL and access the web page.
below is my code.
I am able to invoke and kill the local webserver in seperate python
script,but when i club opening of browser and and subprocess , my like
below ,then my script is not responding.
Please guide me.

import subprocess
import time
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb\mongoose-2.8.exe >YourOutput.txt"')
time.sleep(3)
webbrowser.open("http://43.88.79.229:8080/index.html")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
time.sleep(3)
webbrowser.open("http://43.88.79.229:8080/index.html")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New2\ >YourOutput.txt"')
time.sleep(3)
webbrowser.open("http://43.88.79.229:8080/index.html")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground


This scripts works fine with python 26 in windows XP, but when i
replace the browser opening part with broswer to be open on different
machine in python made tool.That it always give me warning that
process already open.If i kill the the command then also it gives same
problem.
Please guide me is it sycronisation issue?,some exception handling is
required??
 
S

shanti bhushan

I have a code ,in which i invoke the local webserver in back
ground ,then open URL and access the web page.
below is my code.
I am able to invoke and kill the local webserver in seperate python
script,but when i club opening of browser and and subprocess , my like
below ,then my script is not responding.
Please guide me.

import subprocess
import time
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")
time.sleep(11)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
time.sleep(3)
subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
\mongoose-2.8.exe -root D:\New2\ >YourOutput.txt"')
webbrowser.open("http://43.88.79.229:8080/index.html/")


if i want to put exception handing for invoking the local web
server ?? how to do that please guide
 

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
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top