Skip to content

mpremote fs cp fails if file doesn't already exist #10507

@RasmusB

Description

@RasmusB

CircuitPython version and board name

Adafruit CircuitPython 9.2.8 on 2025-05-28; Raspberry Pi Pico with rp2040

(In reality a custom Pi Pico clone designed by me)

Code/REPL

No specific code

Behavior

I'm trying to copy source files to my board, but it fails if a file with the same name doesn't already exist:

mpremote connect id:E464D431C33D2021 fs cp communication.py :      
cp communication.py :
mpremote: Error with transport:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file/directory: ./communication.py

But if I first create the file...

Adafruit CircuitPython 9.2.8 on 2025-05-28; Raspberry Pi Pico with rp2040
>>> file = open("/communication.py", "w")
>>> file.write("Hello world!")
12
>>> file.close()
>>> file = open("/communication.py")
>>> print(file.readline())
Hello world!
>>> file.close()

... the cp command works perfectly and does what it is supposed to do.

mpremote connect id:E464D431C33D2021 fs cp communication.py :communication.py
cp communication.py :communication.py
[Shows copy progress and finishes without error]

I have also tried to omit the target file name like mpremote connect id:E464D431C33D2021 fs cp communication.py : but it makes no difference.

Description

No response

Additional information

mpremote --version
mpremote 1.25.0

I first though this was a bug with mpremote, but it doesn't seem like it:
micropython#17752 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugthird-partyAwaiting action on a third party for a fix or an answer to a request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions