2

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.

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.