tino / pyFirmata

Python interface for the Firmata (http://firmata.org/) protocol. It is compliant with Firmata 2.1. Any help with updating to 2.2 is welcome. The Capability Query is implemented, but the Pin State Query feature not yet.
MIT License
575 stars 193 forks source link

ImportError: cannot import name 'Arduino' from 'pyfirmata' #105

Closed denuradhan closed 3 years ago

denuradhan commented 3 years ago

this is the source code :

from pyfirmata import Arduino, util
import time
board = Arduino('COM7')
iterator = util.Iterator(board)
iterator.start()
button = board.get_pin('d:2:i')
while True:
    print(button.read())
    time.sleep(1)

And this is the output :

  File "c:/Users/ASUS/Documents/Arduino/IOT/praktikum7/pyfirmata.py", line 1, in <module>
    from pyfirmata import Arduino, util
  File "c:\Users\ASUS\Documents\Arduino\IOT\praktikum7\pyfirmata.py", line 1, in <module>
    from pyfirmata import Arduino, util
ImportError: cannot import name 'Arduino' from 'pyfirmata' (c:\Users\ASUS\Documents\Arduino\IOT\praktikum7\pyfirmata.py)
denuradhan commented 3 years ago

my bad, the file name is pyfirmata.py when the program is running it will import itself not the pyfirmata library