I have a Raspberry Pi running on Debian, and I've been trying to access one of its serial ports with a python script, where I try to import pySerial like this:
import serial
ser = serial.Serial('/dev/ttyAMA0', 9600)
ser.write("hello world!")
But I still can't establish the serial connection as executing the script just throws the following error:
AttributeError: 'module' object has no attribute 'Serial'
And what is weirder is that it used to work earlier and now it doesn't even work in the interactive Python interpreter.
I've tried reinstalling the pySerial again and even rewritten the code multiple times to ensure that it's correct but had no luck yet.
Can anybody please tell me where I could be going wrong? Or, just point me in right direction? Please help. TIA!