🐍 CircuitPython is the easiest way to program microcontrollers now celebrating over 200 boards!🐍
0

Trinket MO HID Library Import Error
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trinket MO HID Library Import Error

by bpotter on Sat Feb 27, 2021 10:16 pm

Hello Friends,

I have zero coding experience until now and this error is crushing me. I can't get the adafruit HID library to import.

ImportError: no module named 'adafruit_hid.find_device'

This is my Trinket setup: Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Trinket M0 with samd21e18
I'm editing CircuitPython code with mu-editor on Mac os 10.14.6

I have followed this tutorial
https://www.youtube.com/watch?v=tzDGTYDR_M4

I've dowloaded the latest version 6.x here:
https://circuitpython.org/libraries

I attached an image of where I have put the lib files. I have even tried evert combination of folder and spelling.
Attachments
Screen Shot.png
Screen Shot.png (126.83 KiB) Viewed 85 times

bpotter
 
Posts: 2
Joined: Sat Feb 27, 2021 9:38 pm

Re: Trinket MO HID Library Import Error

by bpotter on Sun Feb 28, 2021 11:55 am

Fixed this by copying individual files over one at a time and adding the _init_.mpy file!

Thanks to Neradoc on Discord for the help:

"NeradocToday at 7:47 AM
python is organised in modules as .py files or .mpy precompiled that take less place, but also as directories that package a module into multiple files, so you can load only the parts you need, the __init__ file is the entry point for a package module
sometimes it does nothing but set like version information, sometimes it's most of the code, in this case it actually contains the find_device function it mentions in the error"

bpotter
 
Posts: 2
Joined: Sat Feb 27, 2021 9:38 pm

Re: Trinket MO HID Library Import Error

by adafruit_support_carter on Mon Mar 01, 2021 3:05 pm

Yep. Best to just copy the whole folder.
https://learn.adafruit.com/welcome-to-c ... 2978253-18
If a library has multiple .mpy files contained in a folder, be sure to copy the entire folder to CIRCUITPY/lib.

adafruit_support_carter
 
Posts: 19820
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.