Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107677
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | David Aldrich <David.Aldrich@EMEA.NEC.COM> |
| Newsgroups | comp.lang.python |
| Subject | How to read from serial port? |
| Date | Tue, 26 Apr 2016 16:20:04 +0000 |
| Lines | 28 |
| Message-ID | <mailman.119.1461691013.32212.python-list@python.org> (permalink) |
| References | <41302A7145AC054FA7A96CFD03835A0A0BAC66F9@EX10MBX02.EU.NEC.COM> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de yaSHKwzMTbO8N/b0t4zTVgrvPxccgtGiMz2VtQsYrZXA== |
| Return-Path | <David.Aldrich@EMEA.NEC.COM> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:How': 0.09; 'typeerror:': 0.09; 'python': 0.10; 'received:85.115': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:port': 0.16; 'true:': 0.16; 'to:name:python-list@python.org': 0.20; 'fix': 0.21; 'please?': 0.22; 'import': 0.24; '(most': 0.24; 'written': 0.24; 'error': 0.27; 'skip:# 10': 0.27; 'received:169.254': 0.28; 'implicitly': 0.29; 'str': 0.29; 'convert': 0.29; 'print': 0.30; 'skip:s 30': 0.31; "can't": 0.32; 'received:169': 0.32; 'run': 0.33; 'traceback': 0.33; 'file': 0.34; 'skip:& 20': 0.35; 'header:Received:8': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'skip:& 10': 0.37; 'url:rec-html40': 0.37; 'charset:us-ascii': 0.37; 'skip:p 20': 0.38; 'data': 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'url:schemas': 0.40; 'url:office': 0.40; 'received:85': 0.60; 'serial': 0.70; 'subject:read': 0.84 |
| Thread-Topic | How to read from serial port? |
| Thread-Index | AdGf1vm0/o4CVEPhTfesqiKSPOCXyg== |
| Accept-Language | en-GB, en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [172.29.68.82] |
| X-Scanned-By | MailControl 44278.1202 (www.mailcontrol.com) on 10.65.0.138 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.22 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <41302A7145AC054FA7A96CFD03835A0A0BAC66F9@EX10MBX02.EU.NEC.COM> |
| Xref | csiph.com comp.lang.python:107677 |
Show key headers only | View raw
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