Page 1 of 1
"os" module not listed with help('modules') - DFRobot Firebeetle
Posted: Tue May 05, 2020 5:39 am
by zoom
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?
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
Posted: Tue May 05, 2020 5:51 am
by pythoncoder
Just issue
help('modules') just lists the modules which are pre-installed. Others are loaded as required.
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
Posted: Tue May 05, 2020 7:44 am
by zoom
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.
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
Posted: Tue May 05, 2020 7:53 am
by Roberthh
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.
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
Posted: Tue May 05, 2020 8:13 am
by zoom
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.