win32api exception names?
David Bolen
db3l at fitlinxx.com
Tue Jul 31 11:15:14 EDT 2001
"G. Willoughby" <thecalm at NOSPAM.btinternet.com> writes:
> could you please explain the code needed a little better? sorry!
>
> if i use something like this:
>
> except win32api.api_error, info:
> win32api.MessageBox(0,"File can not be opened, right double click to
> open\nthe file's directory.", appName, 0, 0)
>
> then i get: AttributeError: 'win32api' module has no attribute 'api_error'
Whoops - my fault. The local module name for the error class is just
"error". So use "win32api.error" in your exception instead of
"api_error" and you should be fine.
It's a little confusing (clearly I forgot :-)), because when
displayed, the error will show up as pywintypes.api_error or just
api_error, but the actual error class is defined in each individual
module as just "error".
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list