subprocess in Command promt+ webbrowser

shanti bhushan ershantibhushan at gmail.com
Sat Jun 19 02:48:35 EDT 2010


On Jun 19, 11:01 am, shanti bhushan <ershantibhus... at gmail.com> wrote:
> 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??



More information about the Python-list mailing list