Motor hat #2348 python code: cannot import Motorkit

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
JimGig
 
Posts: 11
Joined: Fri Jun 18, 2021 5:39 pm

Motor hat #2348 python code: cannot import Motorkit

Post by JimGig »

Hardware: RPi4
Configuration: I ran pip3 install adafruit-circuitpython-motorkit successfully.
Question: Why do I get an error message saying unable to import motorkit? Should I be running code from within python3 REPL or should I use, "python filename.py", from RPi term window?

Following the setup and examples found in tech specs of #2348 motor hat, I get the following message while running python3 REPL. I get a similiar message if I use python "file.py" to run the code from within the RPi term window.

Copied from my RPi term window:

pi@raspberrypi:~/Projects/RCTruck $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from adafruit_motorkit import Motorkit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Motorkit' from 'adafruit_motorkit' (/usr/local/lib/python3.7/dist-packages/adafruit_motorkit.py)

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Motor hat #2348 python code: cannot import Motorkit

Post by dastels »

Try MotorKit, not Motorkit.

Dave

User avatar
JimGig
 
Posts: 11
Joined: Fri Jun 18, 2021 5:39 pm

Re: Motor hat #2348 python code: cannot import Motorkit

Post by JimGig »

Genius!
Can you tell me if I always need to use python3 REPL or can I use python to run scripts/programs directly from a RPi term window?
Thank you.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”