cmbruns / pyopenvr

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

Python 3.5.1 error #8

Closed remdragon closed 8 years ago

remdragon commented 8 years ago

code from readme.md:

import sys, time, openvr

vr_system = openvr.init ( openvr.VRApplication_Scene ) for i in range(100): poses = vr_system.getDeviceToAbsoluteTrackingPose(openvr.TrackingUniverseStanding, 0, openvr.k_unMaxTrackedDeviceCount) pose = poses[openvr.k_unTrackedDeviceIndex_Hmd] print(pose.mDeviceToAbsoluteTracking) sys.stdout.flush() time.sleep(0.2)

openvr.shutdown()

result when headset not ready:

D:\Users\daddy\Dropbox\cvs\fab\openvr>python test.py Using breakpad crash handler Setting breakpad minidump AppID = 250820 Forcing breakpad minidump interfaces to load Looking up breakpad interfaces from steamclient Calling BreakpadMiniDumpSystemInit Traceback (most recent call last): File "test.py", line 3, in vr_system = openvr.init ( openvr.VRApplication_Scene ) File "C:\Python35-32\lib\site-packages\openvrinit.py", line 4045, in init initInternal(applicationType) File "C:\Python35-32\lib\site-packages\openvrinit.py", line 4149, in initInternal _checkInitError(error) File "C:\Python35-32\lib\site-packages\openvrinit.py", line 4031, in _checkInitError raise OpenVRError(getVRInitErrorAsSymbol(error) + str(error)) TypeError: can't concat bytes to str

cmbruns commented 8 years ago

Presumably this problem occurs because I have not been testing python 3 much, since the initial overhaul. I think raising an exception is the correct behavior when the headset is not ready. But there seems to be a string manipulation problem during the too-clever handling of that error when using python 3.

remdragon commented 8 years ago

yes that's what it looks like to me, too. Not sure if getVRInitErrorAsSymbol should return a proper string or it encode should be called on its result here.

cmbruns commented 8 years ago

I'm installing python 3 on the computer in front of me to investigate this now. But if I don't get this done tonight, it might be more than a week before I get back to it. I think the InitError strings might need to be byte strings, to interoperate well with the C API.