I am trying to use a serial port with Python 2.6 on Debian running on my Raspberry P My script tries to import named For some reason it denies establishing a serial connection with this error: When I try to write the same code in the interactive Python interpreter, it still does not work. Strangely, it used to work about a few hours before. What could be the problem? I have tried to fix it for a little while, re-installing picarial, re-writing my code, checking serial ports etc. Thanks in advance! You are importing the module, not the class. Therefore, you have to write: serial.py pySerial:
import serial ser = serial.Serial ('/ dev / ttyAMA0', 9600) ser. Write ("hello world!")
AttributeError: 'module 'Object does not have any attribute' serial '
from serial import serial
Comments
Post a Comment