[python-uk] Here's a little test

Simon Brunning python-uk@python.org
Wed, 28 Aug 2002 15:28:07 +0100


First thought - what's wrong with the webbrowser module?

Second thought - have you tried os.execl(iepath, *args)?

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning@trisystems.co.uk

> -----Original Message-----
> From:	dale@riverhall.co.uk [SMTP:dale@riverhall.co.uk]
> Sent:	Wednesday, August 28, 2002 3:28 PM
> To:	python-uk@python.org
> Subject:	[python-uk] Here's a little test
> 
> I've posted this on clp but not had a response. I thought I'd test you
> guys
> :o)
> 
> 
> I have a little program I've converted from Javascript which I use
> frequently. It doesn't work in Python because the last line keeps
> throwing the error:
> 
> Traceback (most recent call last):
>   File "I:\batch\ie.py", line 22, in ?
>     os.execl(iepath, args)
>   File "C:\Python22\Lib\os.py", line 266, in execl
>     execv(file, args)
> TypeError: execv() arg 2 must contain only strings
> 
> I have tried a variety of formats for the os.execl function,
> including:
> 
> os.execl(iepath, (args, ))
> os.execl(iepath, [args])
> os.execl(iepath, args)
> 
> but it always complains about arg 2 in this way.
> 
> What is execl on about?
> 
> Any help appreciated.
> 
> I'm going to lie down for a while.
> 
> (Python 2.2.1 Win2k SP2)
> 
> Here is the full code (it may wrap):
> ==========================================
> 
> # Run IE - wherever it happens to be.
> # Take URL from clipboard if not supplied as arg
> 
> import sys, os, os.path
> import win32clipboard as clip
> import win32api
> import win32con
> 
> hklm = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App
> Paths\\IEXPLORE.EXE\\"
> 
> if len(sys.argv) > 1:
> 	args = sys.argv[1]
> else:
> 	clip.OpenClipboard(0)
> 	args = clip.GetClipboardData(clip.CF_TEXT)
> 	clip.CloseClipboard()
> 	
> iekey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, hklm,  0,
> win32con.KEY_READ)
> iepath = win32api.RegQueryValueEx(iekey, None)[0]
> win32api.RegCloseKey(iekey)
> 
> os.execl(iepath, args)
> 
> --
> Dale Strickland-Clark
> Riverhall Systems Ltd
> 
> Dale Strickland-Clark
> Riverhall Systems Ltd. Custom database and Web applications.
> http://www.riverhall.co.uk
> Offices: London: 0870 321 0034 Wokingham: 0870 321 2378
> Mobile 0701 071 DALE (3253)
> 
> 
> _______________________________________________
> python-uk mailing list
> python-uk@python.org
> http://mail.python.org/mailman/listinfo/python-uk
> 
> 
> 
> 
-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.