Re: os.popen3() - how to close cmd window automatically?
- From: "Rony Steelandt" <bucodi@xxxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 15:24:19 +0200
Dear Python developers,
I use a short python script in order to run an external application plus to open a browser displaying a default page.
My Setup: Python 2.4.3. / Windows2000
# ----------------------------------------------------------------------
# Script "shortcut.py"
import os
import webbrowser
import win32api
# open default web browser and display webbpage
page = 'C:\\Temp\\Welcome.html'
webbrowser.open(page)
# path to application that is opened
path = "C:\\Program Files\\ExternalApplication.exe"
# get short name
shortpath = win32api.GetShortPathName(path)
# open external application
stdin, stdout, stderr = os.popen3(shortpath)
output = stdout.read()
errors = stderr.read()
stdin.close()
stdout.close()
stderr.close()
print output
print errors
# ----------------------------------------------------------------------
In order to make this Script available on other Windows2000 machines where no Python installation is present, I made this script executable using "py2exe" (http://www.py2exe.org/). This creates a "shortcut.exe" file.
If I run "shortcut.exe" everything works fine but a black empty cmd window opens and its kept open until I close the application "ExternalApplication.exe".
How can I close that black empty window automatically?
Thanks in advance,
Nico
replace console=[... by windows=[... in your setup.py
--
---
Rony Steelandt
BuCodi
rony dot steelandt (at) bucodi dot com
Visit the python blog at http://360.yahoo.com/bucodi
.
- References:
- os.popen3() - how to close cmd window automatically?
- From: Nico Grubert
- os.popen3() - how to close cmd window automatically?
- Prev by Date: Re: problem with google api / xml
- Next by Date: Re: Way to get an array of latitude/longitude points (tuples) from a trip
- Previous by thread: os.popen3() - how to close cmd window automatically?
- Next by thread: Re: os.popen3() - how to close cmd window automatically?
- Index(es):
Relevant Pages
|