Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: must be str, not bytes #16

Open
carstenschroeder opened this issue Feb 8, 2019 · 0 comments
Open

TypeError: must be str, not bytes #16

carstenschroeder opened this issue Feb 8, 2019 · 0 comments

Comments

@carstenschroeder
Copy link

I get the following error:

carsten@ubuntu:~/$ python3 pyjector_test.py 
dict_keys(['computer', 'computer_22', 'component', 'dvi_a', 'dvi_d', 'hdmi', 'hdmi_2', 'composite', 's_video', 'network', 'usb_display', 'usb_reader', 'status'])
ERROR:root:unexpected response to handshake b'>'
Traceback (most recent call last):
  File "pyjector_test.py", line 24, in <module>
    pyjector.source('hdmi')
  File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 298, in handler
    return self._command_handler(command, action)
  File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 255, in _command_handler
    response = self.get_response()
  File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 311, in get_response
    response += self._recv(1)
TypeError: must be str, not bytes

I use the following test script under python 3.6:

from pyjector.pyjector import Pyjector

# Look up what port your projector is connected to, using something
# like `dmesg` if you're on linux.
port = '/dev/ttyUSB0'

# The only valid device id at the moment is `benq`. This is used
# to figure out what commands are supported, and the format needed.
device_id = 'benq'

pyjector = Pyjector(port=port, device_id=device_id)

# Let's check what commands claim to be supported by our device.
#print(pyjector.command_list)

# Let's check the actions associated with each command
#print(pyjector.command_spec)

# Turn the projector on
#pyjector.power('on')
# We need to change the source, which are supported?
print(pyjector.get_actions_for_command('source'))
# Change the source to hdmi-2
pyjector.source('hdmi')
carstenschroeder added a commit to carstenschroeder/pyjector that referenced this issue Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant