[SOLVED] How to perform equiv of os.listdir() in raw REPL?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
jpj
Posts: 60
Joined: Sat Dec 10, 2016 3:07 pm

[SOLVED] How to perform equiv of os.listdir() in raw REPL?

Post by jpj » Mon Dec 19, 2016 4:39 pm

I'm trying to troubleshoot using ampy with my Adafruit huzza and Adalogger w/sdcard. I won't go into great detail here, but the sdcard is now unmounted when I run any ampy commands, so actions are performed on the esp8266 flash filesystem only. ampy worked fine with the sdcard for about a week.

I've provided greater detail here and on the Adafruit user forum: https://github.com/adafruit/ampy/issues/10

In trying to debug the ampy issue, I'd like enter raw REPL (CNTL-A) and perform the equivalent of os.listdir() to see if the mounted sdcard is visible. Any suggestions on how to do this (or other troubleshooting) would be appreciated.

Thanks,
J
Last edited by jpj on Mon Dec 26, 2016 6:39 pm, edited 2 times in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to perform equiv of os.listdir() in raw REPL?

Post by dhylands » Mon Dec 19, 2016 4:55 pm

You should just be able to type the commands. You won't see them echoed back, and they won't be executed until you enter Control-D. On my pyboard if I type:
  • Control-A
    import os
    print(os.listdir('/'))
    Control-D
then I see the following output:

Code: Select all

MicroPython v1.8.4-151-g5f3b9aa-dirty on 2016-10-11; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> 
raw REPL; CTRL-B to exit
>OK['flash']
>
Finally, press Control-B to exit raw REPL mode.

jpj
Posts: 60
Joined: Sat Dec 10, 2016 3:07 pm

Re: How to perform equiv of os.listdir() in raw REPL?

Post by jpj » Mon Dec 19, 2016 5:12 pm

Thanks Dave. Yes that worked:

Code: Select all

>>> os.listdir()
['logtest.py', 'log', 'blink.py', 'blinkred.py', 'hello.py', 'ht16k33_matrix.py', 'test', 'mymodules', 'mytime', 'main.py', 'getrtctime.py', 'empty.py', 'setRtcFromNtp.py', '.Spotlight-V100', 'readfile.py', '.fseventsd', 'font5x8.bin', 'webrepl_cfg.py', 'ht16k33_seg.py', 'bitmapfont.mpy']
>>>
raw REPL; CTRL-B to exit
>OK['logtest.py', 'log', 'blink.py', 'blinkred.py', 'hello.py', 'ht16k33_matrix.py', 'test', 'mymodules', 'mytime', 'main.py', 'getrtctime.py', 'empty.py', 'setRtcFromNtp.py', '.Spotlight-V100', 'readfile.py', '.fseventsd', 'font5x8.bin', 'webrepl_cfg.py', 'ht16k33_seg.py', 'bitmapfont.mpy']
>
Entering raw REPL is not bothering the sdcard mount, so it must be something else ampy is doing.

jpj
Posts: 60
Joined: Sat Dec 10, 2016 3:07 pm

Re: [RESOLVED] How to perform equiv of os.listdir() in raw REPL?

Post by jpj » Mon Dec 19, 2016 9:22 pm

ampy is working with the sdcard again. I'm not certain what the fix was. I created some git branches of earlier micropython releases and installed them on the huzzah. The ampy issue remained, so I reloaded my version 1.8.6 with the frozen sdcard.py and ampy started working with the sdcard.

Thanks to Dave Hylands for helping me with his rshell program. Works well and I now have a backup method for managing files on the esp8266.

https://github.com/dhylands/rshell

Post Reply