Error conecting raspberry with my arduino in a serial port Hi i am trying to make a comunication between theses device but when i am trying to run in my raspberry i have the follow error:


  Traceback (most recent call last):
    File "serial.py", line 1, in 
      import serial
    File "/home/pi/Desktop/serial.py", line 2, in 
      ser = serial.Serial('/dev/ttyACM0', 9600)
  AttributeError: 'module' object has no attribute 'Serial'


i have the next code:

import serial

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

while 1:

    if(ser.in_waiting &gt;0):
        line = ser.readline()
        print(line)


If any can help me, i will be thankfull
What's almost certainly happening here is that you've named your file serial.py, so the import is trying to load the library from your file within the current working directory.

To fix this problem, simply rename your serial.py script to something else, for example serial_comms.py or whatever other useful name you want.