An expression except (OSError, e)never worked in Python, and not the way you think it works. This expression captures two types of exceptions; OSErroror to what is global e. Your code breaks when there is no global name e.
Python 3 Python 2.6 :
except OSError as e:
Python 2 :
except OSError, e:
:
except (OSError, ValueError), e:
. , .
Python 2.6 , . PEP 3110 - Python 3000 2.6 What New.
errno.EPERM; errno, NameError.