open() and EOFError
marko at pacujo.net
Mon Jul 7 19:31:53 CEST 2014
Ian Kelly <ian.g.kelly at gmail.com>:
> It's good practice to keep your try blocks as narrow as possible in
> any case.
True. Unfortunately, that leads to trouble with the handy "with"
with open(path) as f:
If the open() call is guarded against exceptions (as it usually should),
one must revert to the classic syntax:
f = open(path)
More information about the Python-list