In my code I try to interact with some equipment using the serial
module:
from serial import serial
ser = serial.Serial('/dev/ttyUSB0') # open serial port
print(ser.name) # check which port was really used
ser.write(b'hello') # write a string
ser.close()
But I get this error:
cannot import name 'serial' from 'serial' (unknown location)
I searched on Stack Overflow for this error message but I could not find an answer which resolves my problem.
Based on what I found, I tried:
pip install serial
,pip install pyserial
,- and also unistall and reinstall.
How can I fix this error?