cmbruns / pyopenvr

Unofficial python bindings for Valve's OpenVR virtual reality SDK
BSD 3-Clause "New" or "Revised" License
245 stars 39 forks source link

Need better error message when SteamVR does not support request API version #74

Open tomgoddard opened 4 years ago

tomgoddard commented 4 years ago

The error message when pyopenvr fails to connect to SteamVR because an API version is not available should be more informative. Currently it says

VRInitError_Init_InterfaceNotFound (error number 105)

With this message it is not even clear that this is a software API issue -- my immediate thought was it was a hardware connection problem. It took 30 minutes of poking around to hit on the fact that SteamVR needed updating. The error message should say:

"The installed SteamVR runtime could not provide version IVRCompositor_024 requested by pyopenvr. You may need to update SteamVR. VRInitError_Init_InterfaceNotFound (error number 105)"

Even better if you could add "the installed SteamVR runtime provides version IVRCompositor_022".

The actual error came from this pyopenvr/init.py

    version_key = IVRCompositor_Version
    if not isInterfaceVersionValid(version_key):
        _checkInitError(VRInitError_Init_InterfaceNotFound)

So the information about the detailed cause of the error is available and should be reported. All uses of _checkInitError() are currently throwing away information about the cause of the error which makes for debugging nightmares.

After updating pyopenvr to 1.9.1601 in my ChimeraX app it failed to connect to SteamVR with an error message "VRInitError_Init_InterfaceNotFound (error 105)". The trouble was that my SteamVR had not been updated to 1.9.16 because I had not started Steam this month. For my customers it is not unusual that SteamVR will rarely be updated because they do not ever use Steam, and only use SteamVR when started by other apps. So having a good error message is very important. I will of course catch the pyopenvr error, check its test and add to the description that SteamVR probably needs to be updated. But it is still very important that pyopenvr not discard information about the cause of the error.

cmbruns commented 4 years ago

Good investigation. I agree that a better error message would be useful here.

cmbruns commented 4 years ago

Fixed in release 1.10.3001 https://github.com/cmbruns/pyopenvr/releases/tag/1.10.3001 But I did not add the additional message "the installed SteamVR runtime provides version IVRCompositor_022" information because that would be trickier.

tomgoddard commented 4 years ago

Thanks!

cmbruns commented 4 years ago

@tomgoddard I did not actually test that it works as desired, because my SteamVR runtime is already beyond the SDK version. Please keep me informed if you notice it working correctly or otherwise.

tomgoddard commented 4 years ago

Ok