win32api exception names?
G. Willoughby
thecalm at NOSPAM.btinternet.com
Mon Jul 30 19:39:03 EDT 2001
Hi,
See this:
[snip]
def executeFile(event):
if resultPane.size() > 0:
try:
win32api.ShellExecute(0, "open" ,
str(resultPane.get(ACTIVE)),"","",1)
except EnvironmentError:
win32api.MessageBox(0,"File can not be opened, right double
click to open\nthe file's directory.", appName, 0, 0)
[snip]
I'm using this function to open a file listed in a Tkinter Listbox widget,
but i've run into some problems. First when i double click on .htm files
listed they work perfectly, opening in Explorer, But when i double click on
.txt files i get this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "c:\program files\python\lib\lib-tk\Tkinter.py", line 1285, in
__call__
return apply(self.func, args)
File "D:\Backup\Python Programs\PyFind\PyFind.py", line 61, in executeFile
win32api.ShellExecute(0, "open" , str(resultPane.get(ACTIVE)),"","",1)
api_error: (31, 'ShellExecute', 'A device attached to the system is not
functioning.')
i'm trying to handle this exception, but being new to them i dunno what
exception is being raised, the 'except EnvironmentError:' line really isn't
getting it. any ideas?
G.Willoughby
More information about the Python-list
mailing list