open and shut case

Erik Heneryd erik at
Sun Sep 12 13:11:53 CEST 2004

Elaine Jackson wrote:
> Can python close a web-browser window it opened itself? The window in question
> will be displaying a webpage that resides on the local computer, which is
> running Windows 98. Knowing a way to do this would really help me out.

Not easily.  I guess something like this could work, if you have Mark 
Hammonds win32 extensions installed:

(very untested)

import os, win32api
# start browser
pid = os.spawnlp(os.P_NOWAIT, "iexplore.exe", "iexplore.exe", 
# ...
# kill browser
win32api.TerminateProcess(pid, 0)



More information about the Python-list mailing list