Skip to content

How to make it working with Python3 #13

@pierrot10

Description

@pierrot10

Hello,
Thank a lot for that code.
I need to make it working with Python3 but it generate this error message

File "aqi.py", line 130, in
cmd_set_sleep(0)
File "aqi.py", line 104, in cmd_set_sleep
ser.write(construct_command(CMD_SLEEP, [0x1, mode]))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 518, in write
d = to_bytes(data)
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes
raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: 'ª´\x06\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ÿÿ\x06«'

Is there a adapted script for Python3?

Thank a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions