You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> using SerialPorts
julia> s = SerialPort("COM9", 115200)
SerialPorts.SerialPort("COM9",115200,8,"N",1,nothing,false,false,false,PyObject
Serial<id=0x17539518, open=True>(port='COM9', baudrate=115200, bytesize=8, parit
y='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False))
julia> write(s,ASCIIString("G1X2"))
ERROR: PyError (:PyObject_Call) <class 'TypeError'>
TypeError("unicode strings are not supported, please encode to bytes: 'G1X2'",)
File "C:\Users\Chris\Anaconda3\lib\site-packages\serial\serialwin32.py", line
301, in write
data = to_bytes(data)
File "C:\Users\Chris\Anaconda3\lib\site-packages\serial\serialutil.py", line 5
8, in to_bytes
raise TypeError('unicode strings are not supported, please encode to bytes:
%r' % (seq,))
[inlined code] from C:\Users\Chris\.julia\v0.4\PyCall\src\exception.jl:81
in pycall at C:\Users\Chris\.julia\v0.4\PyCall\src\PyCall.jl:79
in call at C:\Users\Chris\.julia\v0.4\PyCall\src\PyCall.jl:388
in write at C:\Users\Chris\.julia\v0.4\SerialPorts\src\SerialPorts.jl:93
julia> write(s, UInt8(42))
ERROR: PyError (:PyObject_Call) <class 'TypeError'>
TypeError("'int' object is not iterable",)
File "C:\Users\Chris\Anaconda3\lib\site-packages\serial\serialwin32.py", line
301, in write
data = to_bytes(data)
File "C:\Users\Chris\Anaconda3\lib\site-packages\serial\serialutil.py", line 6
1, in to_bytes
for item in seq:
[inlined code] from C:\Users\Chris\.julia\v0.4\PyCall\src\exception.jl:81
in pycall at C:\Users\Chris\.julia\v0.4\PyCall\src\PyCall.jl:79
in call at C:\Users\Chris\.julia\v0.4\PyCall\src\PyCall.jl:388
in write at C:\Users\Chris\.julia\v0.4\SerialPorts\src\SerialPorts.jl:89
The text was updated successfully, but these errors were encountered:
I tried writing data to an opened serial port. The problem is the Python side tries to convert the data into bytes, and that conversion fails.
The text was updated successfully, but these errors were encountered: