'module' object has no attribute 'Serial'

Luis Ramon Ramirez Rodriguez

I'm using the following code to communicate my pc with an arduino, but I get the error mentioned in the title, module objet has no attribute Serial.

#!/usr/bin/python

# Importamos la libreira de PySerial
import serial

# Abrimos el puerto del arduino a 9600
PuertoSerie = serial.Serial('/dev/ttyACM0', 9600)
# Creamos un buble sin fin
while True:
  # leemos hasta que encontarmos el final de linea
  sArduino = PuertoSerie.readline()
  # Mostramos el valor leido y eliminamos el salto de linea del final
  print "Valor Arduino: " + sArduino.rstrip('\n')

The curios thing is the the code used to work, but then I installed matplotlib and drawnow libraries, I believe that has caused the problem but I don't know how to fix it, because and need those libraries any way.

The other matter is that is I copy the code line to line into the terminal it works but of course I need I with the loop in a .py file.

geckon

The solution is to not name the source file serial.py since in such case Python takes that instead of the actually desired serial module.

(Since the question was solved in the comments and no answer has been posted, inspired by a relevant meta question I'm adding this answer to make the question complete. I'm not trying to get credit for deets' solution and I'm posting it as a community wiki answer.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Custom Module - Object Has No Attribute

From Dev

AttributeError: 'module' object has no attribute

From Dev

'module' object has no attribute 'DataFrame'

From Dev

AttributeError: 'module' object has no attribute

From Dev

'module' object has no attribute 'GeoSQLCompiler'

From Dev

AttributeError: 'module' object has no attribute

From Dev

module object has no attribute oauth

From Dev

'module' object has no attribute 'get'?

From Dev

module' object has no attribute 'SelectDateWidget'

From Dev

'module' object has no attribute 'GeoSQLCompiler'

From Dev

'module' object has no attribute 'cut'

From Dev

'module' object has no attribute 'shortcuts'

From Dev

'module' object has no attribute 'get'?

From Dev

'module' object has no attribute 'TK'

From Dev

AttributeError:'module' object has no attribute 'call' :Python

From Dev

Pylab - 'module' object has no attribute 'Figure'

From Dev

AttributeError: 'module' object has no attribute 'tk'

From Dev

AttributeError: 'module' object has no attribute 'cache'

From Java

AttributeError: 'module' object has no attribute 'tests'

From Dev

'module' object has no attribute 'views' django error

From Dev

AttributeError: 'module' object has no attribute 'TestCase'

From Dev

AttributeError: 'module' object has no attribute 'version'

From Dev

Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

From Dev

Using numpy 'module' object has no attribute 'array'

From Dev

AttributeError: 'module' object has no attribute 'plotting'

From Dev

Python - 'module' object has no attribute 'randrange'

From Java

AttributeError: 'module' object has no attribute 'request'

From Java

tensorflow:AttributeError: 'module' object has no attribute 'mul'

From Java

AttributeError: 'module' object has no attribute 'urlretrieve'

Related Related

  1. 1

    Custom Module - Object Has No Attribute

  2. 2

    AttributeError: 'module' object has no attribute

  3. 3

    'module' object has no attribute 'DataFrame'

  4. 4

    AttributeError: 'module' object has no attribute

  5. 5

    'module' object has no attribute 'GeoSQLCompiler'

  6. 6

    AttributeError: 'module' object has no attribute

  7. 7

    module object has no attribute oauth

  8. 8

    'module' object has no attribute 'get'?

  9. 9

    module' object has no attribute 'SelectDateWidget'

  10. 10

    'module' object has no attribute 'GeoSQLCompiler'

  11. 11

    'module' object has no attribute 'cut'

  12. 12

    'module' object has no attribute 'shortcuts'

  13. 13

    'module' object has no attribute 'get'?

  14. 14

    'module' object has no attribute 'TK'

  15. 15

    AttributeError:'module' object has no attribute 'call' :Python

  16. 16

    Pylab - 'module' object has no attribute 'Figure'

  17. 17

    AttributeError: 'module' object has no attribute 'tk'

  18. 18

    AttributeError: 'module' object has no attribute 'cache'

  19. 19

    AttributeError: 'module' object has no attribute 'tests'

  20. 20

    'module' object has no attribute 'views' django error

  21. 21

    AttributeError: 'module' object has no attribute 'TestCase'

  22. 22

    AttributeError: 'module' object has no attribute 'version'

  23. 23

    Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

  24. 24

    Using numpy 'module' object has no attribute 'array'

  25. 25

    AttributeError: 'module' object has no attribute 'plotting'

  26. 26

    Python - 'module' object has no attribute 'randrange'

  27. 27

    AttributeError: 'module' object has no attribute 'request'

  28. 28

    tensorflow:AttributeError: 'module' object has no attribute 'mul'

  29. 29

    AttributeError: 'module' object has no attribute 'urlretrieve'

HotTag

Archive