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?
"os" module not listed with help('modules') - DFRobot Firebeetle
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
Just issue
help('modules') just lists the modules which are pre-installed. Others are loaded as required.
Code: Select all
import os
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: "os" module not listed with help('modules') - DFRobot Firebeetle
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
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.
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
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.