Skip to content

send_to_client sends strings instead of bytes #3

Description

@Fiammante95

Hi! I'm pretty new to python, however I cloned your repo so to create a custom adapter for a custom device. I am running adapter.py with python 3.9.5. In my environment, the send_to_client method would throw an "TypeError: a bytes-like object is required, not 'str'".

I edited mtconnect_adapter.py to change all the

print ""

in

print()

and to change

send(<string>)

into

send(bytes(<string>, "utf-8"))

With these changes, the adapter.py is not throwing any exceptions. I am using the latest x64 release of cppagent for Windows 10 as the agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions