← index #9286PR #8237
Related · medium · value 2.217
QUERY · ISSUE

windows: os.sep should be backslash

openby jimmoopened 2022-09-12updated 2022-09-15
enhancement

This came up in https://github.com/micropython/micropython-lib/pull/527, and we have a workaround there, but getting this right will be required to make os.path work correctly.

The windows port current returns / from os.sep but should be \. We should fix that, as well as implementing os.altsep for unix/windows (return None on unix, / on windows).

CANDIDATE · PULL REQUEST

tools/mpremote: Fix "fs cp -r" on Windows.

closedby andrewleechopened 2022-02-01updated 2022-02-04
tools

Currently when using mpremote fs cp -r _manifest : on windows, it does not correctly handle the \ path separator, resulting in things like

cp _manifest\config_def.mpy :_manifest/_manifest\art.mpy

which gets even worse on-device:

os.listdir("/_manifest")
['_manifest\x07rt.mpy', ...]

Changing to a simply '/',join() appears to fix this problem cleanly.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied