Reputation: 1724
I am using Python3 in Windows 7 and I installed pyserial 3.3. I create a file named serial.py with these line codes:
import serial
ser = serial.Serial('COM4', 9600, timeout=0)
ser.write(b'mymessage')
it will show this error message:
attributeError: module 'serial' has no attribute 'Serial'
for all other samples in their documentation it's same, and I could not use any of them.
Upvotes: 1
Views: 9520
Reputation: 1724
Hah!
the problem was my filename. I was using same file name with my python package!
I changed my filename from serial.py
to test.py
and it start working.
Upvotes: 6