If I'm dropping a file through USB on the disk, I can use it immediately within the mpy environment.
So now I have a program that writes a file 'FILE.TXT' to the '/sd' volume.
Closing , flushing and syncing does not show the file at the other side (USB side).
Also the file is gone after some action.
Did I overlook something?
Code: Select all
# at REPL - open file, write read , close
>>> f=open('/sd/FILE.TXT','rw')
>>> f.write("HELLO\r\n")
7
>>> f.flush()
>>> f.seek(0)
0
>>> f.read()
'HELLO\r\n'
>>> f.close()
# directory "/sd"
>>> os.listdir()
['._.Trashes', 'boot.py', '.Trashes', 'main.py', 'log_3638.csv', 'log_4523.csv', '._boot.py', 'templogger.py', 'cardreader.py', 'datalogger.py', '.Spotlight-V100', '._cardreader.py', '._datalogger.py', '._templogger.py', 'show_pins.py', 'LOGGER.py', 'lib', '._LOGGER.py', '.TemporaryItems', '.fseventsd', 'log_260356.csv', 'FILE.TXT', 'System Volume Information']
>>>
# file is visible
# add a file "SDCARD" at the host to the PYB USB MASS STORAGE DEVICE (the other side)
>>>
>>> os.listdir()
['._.Trashes', 'boot.py', '.Trashes', 'main.py', 'log_3638.csv', 'log_4523.csv', '._boot.py', 'templogger.py', 'cardreader.py', 'datalogger.py', '.Spotlight-V100', '._cardreader.py', '._datalogger.py', '._templogger.py', 'show_pins.py', 'LOGGER.py', 'lib', '._LOGGER.py', '.TemporaryItems', '.fseventsd', 'log_260356.csv', 'SDCARD', '._SDCARD', 'System Volume Information']
>>>
# file is missing