(A) You'll have to be more specific about your problem if you want us
to help. Under which circumstances did it work or not? What exactly is
the problem?
(B) Where you put your error-handling is up to you. It depends on what
the function does and how it is to respond. Do you want the function to
t
I put the try catch in my main-method, and it worked to some extent
(except from when I try to read from a file with no content)
Any idea how to solve that?
And is it a good place to have a try-except in main instead of in the
class methods?
My code is at http://nibbler.no/blog/wp-includes/Bookma
Without seeing more of your code, I'm not sure what you are doing
wrong. This works:
ex.py vv
def xopen(path):
try:
return open(path)
except IOError, e:
print 'Error:', e.args[1]
xopen('xyzzy')
^^
$ python ex.py
Error: No such file or direct