2

I get this traceback when attempting to connect to a serial port on ubuntu 16.04

File "debugRead2.py", line 6, in <module>
ser = serial.Serial('/dev/ttyACM0', 115200)
AttributeError: module 'serial' has no attribute 'Serial'

My file is named debugRead2.py so it isn't an issue with naming.

When I change:

import serial
ser = serial.Serial('/dev/ttyACM0', 115200)

to

from serial import serial
ser = serial.Serial('/dev/ttyACM0', 115200)

I get:

Traceback (most recent call last):
  File "debugRead2.py", line 1, in <module>
    from serial import serial
ImportError: cannot import name 'serial'

I have both the serial and pyserial packages installed.

jwpfox
  • 5,124
  • 11
  • 45
  • 42

0 Answers0