Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107677
| From | David Aldrich <David.Aldrich@EMEA.NEC.COM> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | How to read from serial port? |
| Date | 2016-04-26 16:20 +0000 |
| Message-ID | <mailman.119.1461691013.32212.python-list@python.org> (permalink) |
| References | <41302A7145AC054FA7A96CFD03835A0A0BAC66F9@EX10MBX02.EU.NEC.COM> |
Hi
I have written a very simple program to read and print data from the serial port using pyserial:
#!/usr/bin/python3
import serial
ser=serial.Serial('COM1',115200)
while True:
out = ser.read()
print('Receiving...'+out)
When I run it and send data for it to read I get:
C:\SVNProj\Raggio\trunk\hostconsole\gui\prototypes\serial_test>py serial_read.py
Traceback (most recent call last):
File "serial_read.py", line 9, in <module>
print('Receiving...'+out)
TypeError: Can't convert 'bytes' object to str implicitly
I am using Python 3.5. How would I fix this error please?
Best regards
David
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How to read from serial port? David Aldrich <David.Aldrich@EMEA.NEC.COM> - 2016-04-26 16:20 +0000
csiph-web