Controlling the Opera browser under UNIX
Martin Franklin
martin.franklin at westgeo.com
Fri Oct 12 04:16:08 EDT 2001
Jaroslav Gergic wrote:
> The webbrowser module in the Python 2.1 does not
> support the Opera browser directly.
>
I think I posted this a few months ago....... here it is again.
from webbrowser import *
class Opera:
def _remote(self, action):
cmd = "opera -remote '%s' >/dev/null 2>&1 &" % (action)
rc = os.system(cmd)
if rc:
import time
os.system("opera &")
time.sleep(PROCESS_CREATION_DELAY)
rc = os.system(cmd)
return not rc
def open(self, url, new=0):
if new:
self.open_new(url)
else:
self._remote("openURL(%s)" % url)
def open_new(self, url):
self._remote("openURL(%s, new-window)" % url)
register("opera", Opera)
More information about the Python-list
mailing list