You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenKey throws a WindowsError if the registry key it's looking for can't be found in python2. So in python2, where WindowsError is distinct from and not a subclass of IOError, a lookup attempt on a missing registry key is not caught and crashes setuptools. In my case a missing visual studio registry key was stopping the install, whereas the intention was to fall back to a default.
It actually seems like it would be most prudent to catch EnvironmentError, apparently this is what winreg.OpenKey throws in python3 and would also catch WindowsError in python2.
On Python 3, if OpenKey don't found the key a FileNotFoundError is raised (subclass of IOError, FileNotFoundError is not available on Python 2). But, indeed, like wrote in the doc and said by shortenda, this function may also raise WindowsError (On Python 2) or OSError (On Python 3).
IOError have been merged in OSError only since Python 3.3.
So, to cover all case, we need to except OSError and IOError.