MicroPico: Autorun main.py script fails almost immediately if connected to MicroPico

Script uploaded to the board stops almost immediately after a hard reset/usb unplug if vREPL is running in the VSCode

What are the steps to reproduce this issue?

  1. Make a simple python script that blinks 10 times (no loops, just copy paste led.toggle() & sleep(0.25) - name it main.py
  2. Upload current file to Pico
  3. Hard reset

What happens?

If led is toggled every 0,25 sec - it will turn on once and turns off and stops execution If led is toggled every 1 sec it will turn on and stops execution So it’s either time based or based on how fast the board connects to the laptop via usb

What were you expecting to happen?

Board restarts and script executes every line of code

Any other comments?

Replace step 3 with “Soft reset & listen” and script will work in it’s entirety. Same happens if I unplug/plug the board when VScode is closed (I guess when vREPL is not running) - it works. It also works fine when run manually (via Run button)

tl;dr - autorun main.py script stops almost immediately when the board is plugged via USB to the computer that is running MicroPico in VSCode. It runs fine when plugged to a laptop that doesn’t run MicroPico, or plugged into a power brick. I’ve tested this on three different boards, one brand new - same behaviour

Which version of MicroPico are you using?

v3.4.1

Support info

Version: 1.83.1 (user setup)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:48:05.904Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I think that would be more generic 👍 would fit for all module fs and firmware stuff. Thank you so much, I’ll test it asap.

The script itself could be just a file inside the project directory, don’t even need to be on the board, if just used for running once?

I could also only add a setting for your vscode settings.json where you could set a filename on the board to be executed if present on connection with MicroPico. Does this sound good?