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

SteamVR initialization unknown error code 1002 #91

Open tomgoddard opened 1 year ago

tomgoddard commented 1 year ago

The initialization error code 1002 is not listed in pyopenvr/error_codes/init.py and this causes a cryptic KeyError instead of reporting why initialization failed. It looks like this error code is “Oculus Link Not Enabled (1002)” SteamVR error as given on this web page https://smartglasseshub.com/oculus-link-not-enabled-steamvr/ although I did not find documentation for it. It would be good to add this error string. Also it would probably when encountering an unknown error code to report "Unknown error code" instead of giving a KeyError that most users will struggle to even figure out it is a VR startup problem.

This traceback was reported in ChimeraX a molecular visualization package

https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/7774

I did not reproduce this error and the reporter did not provide their email. The traceback is here

File "C:\Program Files\ChimeraX 1.4\bin\lib\site-
packages\chimerax\vive\vr.py", line 506, in start_vr  
self._vr_system = vrs = openvr.init(openvr.VRApplication_Scene)  
File "C:\Program Files\ChimeraX 1.4\bin\lib\site-
packages\openvr\\__init__.py", line 7209, in init  
initInternal2(applicationType, pStartupInfo)  
File "C:\Program Files\ChimeraX 1.4\bin\lib\site-
packages\openvr\\__init__.py", line 7341, in initInternal2  
openvr.error_code.InitError.check_error_value(error.value)  
File "C:\Program Files\ChimeraX 1.4\bin\lib\site-
packages\openvr\error_code\\__init__.py", line 20, in check_error_value  
error_class = cls.error_index[int(error_value)]  
KeyError: 1002  
cmbruns commented 1 year ago

Thank you for the report.

This error code was added to OpenVR in August 2022 https://github.com/ValveSoftware/openvr/blame/08de3821dfd3aa46f778376680c68f33b9fdcb6c/headers/openvr.h#L1816

But we somehow failed to update the openvr.h and openvr_capi.h headers for the latest 1.23.0701 release. copy_libs.py should have taken care of that.

I'll try to put together an updated release in the next week or so.

tomgoddard commented 1 year ago

Thanks! It is not urgent and can wait until the next planned release. I saw your pyopenxr project and have been using OpenXR on Unity and will be excited to try it out in soon in our Python/C++ ChimeraX molecular visualization packages which is currently using pyopenvr.