Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

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/
Please be positive and constructive with your questions and comments.

Motor hat #2348 python code: cannot import Motorkit

by JimGig on Fri Oct 15, 2021 2:16 pm

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)

JimGig
 
Posts: 9
Joined: Fri Jun 18, 2021 5:39 pm

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

by dastels on Fri Oct 15, 2021 2:37 pm

Try MotorKit, not Motorkit.

Dave

dastels
 
Posts: 7983
Joined: Tue Oct 20, 2015 3:22 pm

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

by JimGig on Fri Oct 15, 2021 2:49 pm

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.

JimGig
 
Posts: 9
Joined: Fri Jun 18, 2021 5:39 pm

Please be positive and constructive with your questions and comments.