"os" module not listed with help('modules') - DFRobot Firebeetle

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
zoom
Posts: 4
Joined: Tue May 05, 2020 5:26 am

"os" module not listed with help('modules') - DFRobot Firebeetle

Post by zoom » Tue May 05, 2020 5:39 am

New to the whole micropython thing.

>>>help('modules')

produces a list that does not include "os"

I can import os and use it's functions so, it must be there but this makes me nervous - what other modules are not appearing in the results of the above command? Is there a comprehensive command that, in effect, says I really, really want to see a list of all the modules?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: "os" module not listed with help('modules') - DFRobot Firebeetle

Post by pythoncoder » Tue May 05, 2020 5:51 am

Just issue

Code: Select all

import os
help('modules') just lists the modules which are pre-installed. Others are loaded as required.
Peter Hinch
Index to my micropython libraries.

zoom
Posts: 4
Joined: Tue May 05, 2020 5:26 am

Re: "os" module not listed with help('modules') - DFRobot Firebeetle

Post by zoom » Tue May 05, 2020 7:44 am

Well, I knew I could import it and I know that I can upload files to provide other modules but I am wondering how I list all the modules that are available.

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: "os" module not listed with help('modules') - DFRobot Firebeetle

Post by Roberthh » Tue May 05, 2020 7:53 am

If you look at the output of help("modules"), you see a lot of module names starting with an 'u'. These are the "micro" versions of standard modules, which you usually also can import without that u, so utime as time, uarray as array, .... This is not the case for modules implemented as frozen bytecode, and it is not possible to tell the difference without trying.
They are "Micro", because they usually do not implement the full feature set of CPythons module.

zoom
Posts: 4
Joined: Tue May 05, 2020 5:26 am

Re: "os" module not listed with help('modules') - DFRobot Firebeetle

Post by zoom » Tue May 05, 2020 8:13 am

Thanks Roberthh. I had just found an earlier post of yours that ID'd os as an alias to uos. Along the way, I found the "u" prefix meaning micropython-specific. Now I'm invoking "import os" with something more than a blind trust that it's there.

Post Reply