Exception holes, again.

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Mon Nov 5 14:34:27 CET 2001


"Steve Holden" <sholden at holdenweb.com> wrote:

>Dale:
>
>If you can persuade the Python interpreter to raise this error, surely the
>exception traceback tells you exactly what you need to check for in terms of
>module.exceptionname? Or am I mistaken? The exception is probably defined in
>an extension library.
>
>regards
> Steve

Well, I'd have thought so too.

Here's a little program to provoke an error:

import win32api
import win32con

key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, "Software", 0,
    win32con.KEY_READ)
print win32api.RegQueryValueEx(key, 'Spam')

...and here's the traceback:

Traceback (most recent call last):
  File "I:\BATCH\tests\testreg2.py", line 6, in ?
    print win32api.RegQueryValueEx(key, 'Spam')
pywintypes.api_error: (2, 'RegQueryValueEx', 'The system cannot find
the file specified.')

Doesn't tell you much, does it!

I've tried to find pywintypes but can't and I had a hunt through the
Python directories to see if I could find the definition but came up
with nothing.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list