Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [serial_test.py]
- from periphery import Serial
- serial = Serial("/dev/ttyS0", 115200)
- serial.write(b"Hello World!")
- buf = serial.read(128, 0.5)
- print("read %d bytes: _%s_" % (len(buf), buf))
- serial.close()
- $ python3 serial_test.py
- Traceback (most recent call last):
- File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 166, in _open
- termios.tcsetattr(self._fd, termios.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
- termios.error: (5, 'Input/output error')
- Traceback (most recent call last):
- File "serial.py", line 5, in <module>
- serial = Serial("/dev/ttyS0", 115200)
- File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 60, in __init__
- self._open(devpath, baudrate, databits, parity, stopbits, xonxoff, rtscts)
- File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 168, in _open
- raise SerialError(e.errno, "Setting serial port attributes: " + e.strerror)
- AttributeError: 'error' object has no attribute 'errno'
- $ stty -F /dev/ttyS0
- stty: /dev/ttyS0: Input/output error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement