Christopher Subich  <[EMAIL PROTECTED]> wrote:
>try:
>    f = file('file_here')
>    do_setup_code
>    do_stuff_with(f)
>except IOError: # File doesn't exist
>    error_handle

It's also a good idea to keep try blocks as small as possible, so you
know exactly where the error happened.  Imagine if do_setup_code or
do_stuff_with(f) unexpectedly threw an IOError for some reason totally
unrelated to the file not existing.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to