[windows]no os.listdir and help

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
oyster
Posts: 26
Joined: Tue Feb 16, 2021 1:21 pm

[windows]no os.listdir and help

Post by oyster » Thu Feb 18, 2021 3:12 pm

I have compiled `micropython.exe` in msys2+mingw64. there is `os.ilistdir`, but no `os.listdir` which exists on esp8266

there is no `help` too

what is the step to enable/disable these specified functions on windows? Thanks

Code: Select all

>>> import os
>>> dir(os)
['__class__', '__name__', 'remove', 'errno', 'getenv', 'ilistdir', 'mkdir', 'putenv', 'rename', 'rmdir', 'stat', 'system', 'unsetenv']
>>> help('modules')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'help' isn't defined



User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [windows]no os.listdir and help

Post by jimmo » Fri Feb 19, 2021 3:41 am

oyster wrote:
Thu Feb 18, 2021 3:12 pm
I have compiled `micropython.exe` in msys2+mingw64. there is `os.ilistdir`, but no `os.listdir` which exists on esp8266
I'm not entirely sure why the Unix port (and the Windows which is based on the Unix port) don't implement listdir. It would be relatively straightforward to add. See ports/unix/modos.c
oyster wrote:
Thu Feb 18, 2021 3:12 pm
there is no `help` too
This can be enabled in ports/windows/mpconfigport.h -- add:

#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)

Post Reply