I’m looking to use pio for CI/CD process and have been doing some investigation into using pio installed within a Docker imager, running on a Ubuntu server that has physical devices Arduino etc connected via USB.
I have a docker image that runs ok, and I can pipe the USB device into the docker image ok, but when I try to run commands remotely I keep running into the following error on the remote client:
a bytes-like object is required, not 'str'
Which gives the following stack dump on the remote agent:
PIO Plus (https://pioplus.com) v2.5.2 2019-07-23 08:55:14 [info] Name: platformio-test01 2019-07-23 08:55:14 [info] Connecting to PIO Remote Cloud 2019-07-23 08:55:14 [info] Successfully connected 2019-07-23 08:55:14 [info] Authenticating 2019-07-23 08:55:15 [info] Successfully authorized 2019-07-23 08:55:19 [info] Remote command received: b'device.list' Peer will receive following PB traceback: Unhandled Error Traceback (most recent call last): File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 173, in gotItem self.callExpressionReceived(item) File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 136, in callExpressionReceived self.expressionReceived(obj) File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 621, in expressionReceived method(*sexp[1:]) File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1025, in proto_message self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw) --- <exception caught here> --- File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1054, in _recvMessage netResult = object.remoteMessageReceived(self, message, netArgs, netKw) File "/home/isa56k/.platformio/packages/contrib-pysite/twisted/spread/flavors.py", line 125, in remoteMessageReceived state = method(*args, **kw) File "<string>", line 52, in remote_cmd builtins.TypeError: a bytes-like object is required, not 'str'
I found an article here that references “Ran into issues with the dreader bytes/string problems”. Which I am assuming is a bit of a common problem?
I also noted a github issue here where it looks like this is fixed:
I have run pio update on both ends agent/client but still seem to get this error when issuing any remote commands. e.g. pio remote device list / pio remote test -e uno etc…
I have also tested it outside of Docker and can reproduce the same behaviour.
I am using Ubuntu Server 19.04 / python3 / pio v4.0.0
Any ideas? Has anyone hit similar issues?