Page 1 of 1

Python library issue

Posted: Thu Feb 07, 2019 1:34 pm
by Madmatt
Hi all I have some issues with python library, hope some1 can help me out:
I'm trying to use the python library on a software called touchdesigner(windows 10) to control an engine from serial port.
it supports python and external modules.

I'm trying to do some basic functions but i cant communicate with the board.
At the moment i m still connected via usb serial.

this is the code I m trying to use:

from roboclaw import Roboclaw

#Windows comport name
rc = Roboclaw("COM7",38400)
#Linux comport name
#rc = Roboclaw("/dev/ttyACM0",115200)


address = 0x80


i got some errors as output:

python >>>
Traceback (most recent call last):
File "</project1/text1:op('/project1/text1').run()>", line 1
td.Error: File "/project1/text1", line 12
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\", line 647, in ForwardM1
return self._write1(address,self.Cmd.M1FORWARD,val)
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\", line 311, in _write1
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\", line 126, in _sendcommand
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\serial\", line 308, in write
data = to_bytes(data)
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\serial\", 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: '\x80'
Results of run operation resulted in exception. <type:textDAT path:/project1/text1> <class 'td.textDAT'>
python >>>

Can someone help me to figure out what s happening?

Re: Python library issue

Posted: Thu Feb 07, 2019 1:44 pm
by Madmatt
just to add the issue here seems to be related to unicode string conversion of the address (0x80 - which is expressed in hex seems)

Re: Python library issue

Posted: Thu Feb 07, 2019 1:54 pm
by Madmatt
sorry again forgot to say i m using a roboclaw 2*15 a motor controller

Re: Python library issue

Posted: Fri Feb 08, 2019 10:23 am
by Basicmicro Support
What version of Python are you using? My guess is Python 3? Python 3 doenst allow certain conversions that Ptyhon 2.7 supported. Contact for a pre-release of a Python 3 version of the library assuming you are using Python 3.