os.execl is messing me about!

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Wed Aug 28 14:06:09 CEST 2002

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,

os.execl(iepath, (args, ))
os.execl(iepath, [args])
os.execl(iepath, args)

but it always complains about arg 2 in this way.

What is excel on about?

Any help appreciated.

I'm going to lie down for a while.

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

if len(sys.argv) > 1:
	args = sys.argv[1]
	args = clip.GetClipboardData(clip.CF_TEXT)
iekey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, hklm,  0,
iepath = win32api.RegQueryValueEx(iekey, None)[0]

os.execl(iepath, args)

Dale Strickland-Clark
Riverhall Systems Ltd

More information about the Python-list mailing list