Exception and finally question

Tung Wai Yip tungwaiyip at yahoo.com
Thu Apr 24 18:58:17 EDT 2003


Hello,

How to I access the exception object in a handler?

try:
    raise NameError, 'HiThere'
except NameError:
    #how to print the message 'Hi There' here?

Why except and finally can't be used together? I like to log a error
message if an exception is throw. And I a file to be guaranteed to be
close. What can't I do them together?

Wai Yip Tung




More information about the Python-list mailing list