this is a continuation of question Catching an exception while using a Python 'with' statement. I\'m quite e newbie and I tested the following code with Python 3.2 o
try: f = open('foo.txt', 'a') except IOError: print('error') else: with f: # # some_code #