I'm trying to read all files with .asm
and .py
extensions in an sd card using MicroPython.
I checked the answers in this question but they don't work with MicroPython.
MicroPython doesn't have glob
nor pathlib
and when using os
library and try this code:
for file in os.listdir('/sd'):
filename = os.fsdecode(file)
if filename.endswith(".asm") or filename.endswith(".py"):
print(filename)
I get this error 'module' object has no attribute 'fsdecode'
How can I get this to work with MicroPython?