I am trying to access the serial port with Python 2.6 on my Raspberry Pi running Debian. My script called serial.py trying to import pySerial:
import serial ser = serial.Serial('/dev/ttyAMA0', 9600) ser.write("hello world!")
For some reason, he refuses to establish a serial connection with this error:
AttributeError: 'module' object has no attribute 'Serial'
When I try to enter the same code in the interactive Python interpreter, it still doesn't work.
Oddly enough, it worked about a couple of hours ago.
What could be the problem? I tried to fix this for a while by installing pySerial again, rewriting my code, double checking the serial port, etc.
Thanks in advance!
python serial-port raspberry-pi
hao_maike Jul 09 2018-12-12T00: 00Z
source share