microdot icon indicating copy to clipboard operation
microdot copied to clipboard

Microdot, Micropython and Raspberry Pi Pico W

Open cheeseshark opened this issue 3 years ago • 5 comments

I am attempting to use Microdot with Micropython v1.19.1-88-g74e33e714 on a Raspberry Pi Pico W.

When I attempt to import a class from the microdot.py file (from microdot import Microdot) I receive the following error:

Traceback (most recent call last): File "", line 1, in ImportError: no module named 'microdot.Microdot'

When I import as a whole (import microdot) it imports, but none of the classes are available (app = Microdot() )

Is this an issue with Microdot not being supported by this version of Micropython?

Thanks in advance

-- Mike

cheeseshark avatar Aug 23 '22 19:08 cheeseshark

No, this has to be something that is wrong on your side, since I've personally tested the Pico W recently.

Can you show me a directory listing with all the files that you have on your device, including their sizes? My guess is that your microdot.py is corrupted or invalid.

miguelgrinberg avatar Aug 23 '22 19:08 miguelgrinberg

I'm using Thonny, I'm not sure how to show details on the file list, but I can show individual file properties.

I've attached a screen shot of the Thonny interface. microdot_error

I downloaded the code, and unzipped it to a directory, then uploaded the microdot.py to the device using Thonny.

cheeseshark avatar Aug 23 '22 19:08 cheeseshark

probably it's trying to import from microdot folder and not microdot.py file.

raven703 avatar Aug 23 '22 19:08 raven703

probably it's trying to import from microdot folder and not microdot.py file.

@raven703 that was it exactly! Thanks raven703!

cheeseshark avatar Aug 23 '22 19:08 cheeseshark

Oh, I see, so you put the microdot files inside a microdot folder. Then the import should have been:

from microdot.microdot import Microdot

The first microdot is for your folder, the second is for the microdot.py file. It's better to move the files to the top and not use a folder though.

miguelgrinberg avatar Aug 23 '22 19:08 miguelgrinberg