QUERY · ISSUE
VFS FatFS: mkdir with trailing slash fails when it should succeed
On CPython and unix uPy, os.mkdir('directory/') makes the requested directory. But on bare metal ports using VFS with FatFS it fails with ENOENT because of the trailing slash. I'd say this should be fixed. (And in fact CPy and unix uPy allow any number of trailing slashes).
CANDIDATE · ISSUE
stmhal: os directory operations throw cryptic errors on paths with trailing '/'
It seems as though directory operations (listdir, mkdir, chdir, etc.) with the 'os' module throw cryptic errors when the path contains a trailing '/'. For example: '/sd/cache/' as opposed to the working '/sd/cache'.
>>> os.listdir('/flash/cache/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] EINVAL
>>> os.listdir('/flash/cache')
[]
>>> os.mkdir('/sd/cache/test2/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: Error creating directory '/sd/cache/test2/'
>>> os.mkdir('/sd/cache/test2')
>>> os.chdir('/flash/cache/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: No such file or directory: '/flash/cache/'
>>> os.chdir('/flash/cache')