Is it possible to programmatically create a directory on the SD in Python?
In “regular” Python, I’d use something like import os; os.makedirs, but in MicroPython, the docs suggest the use of the uos library as an equivalent. The Python runtime on the Vex brain does not include the uos library.
Is there a way to do this in Vex Python?
I understand SD card support in Python is basic, but I feel directory creation is not too much to ask from a basic implementation.
I did find this forum post that says directory scanning is not supported. It does not mention directory creation, so I do not think this is a duplicate topic.
As JPearman has stated, the normal OS python functions are not supported. Therefore, to create directory functionality, you would need to implement a pseudo directory structure using regular files and local conventions. For example, you could start by deciding that a specific file, for example DIR.DIR be used to hold a list of “known” files on the device.
The lack of an absolute time reference and likelihood of unplanned power shutoffs could make the contents of DIR.DIR and any “subdirectories” relatively fragile.
For ideas, you could look at the references on implementation of DOS or Linux file systems. As VEXOS does implement file creation, reading and writing, you can limit your code to tracking the list of files on the drive and any structure you want to maintain among them.
Good luck, I have also been thinking about this issue and would be interested in any progress you make.