paulober / MicroPico

MicroPico (aka Pico-W-Go) is a Visual Studio Code extension designed to simplify and speed up the development of MicroPython projects for the Raspberry Pi Pico and Pico W boards.
https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go
Mozilla Public License 2.0
279 stars 25 forks source link

Cannot "Switch Stubs". Incorrect command-line quoting? #252

Closed ziesemer closed 2 weeks ago

ziesemer commented 2 weeks ago

Please provide a clear and concise description of the bug along with logs

It has been over a year since I've touched MicroPico, so not all sure what has changed since then. However, even opening a prior project from then, or with a new project I'm attempting from scratch, I'm getting errors about import machine for a MicroPython project from Pylint - though this may just be a Pylint configuration issue.

Regardless - if I try the "Switch Stubs" command, I think "Included" is working? However, If I choose "RPi Pico" (or "W"), and any version, including the latest (1.2.3.0.post2) - I get the following:

2024-09-15 21:51:15.405 [error] Error: Command failed: &"C:\WINDOWS\py.EXE -m pip" install micropython-rp2-rpi_pico_w-stubs==1.23.0.post2 --target "C:\Users\mark/.micropico-stubs/micropython-rp2-rpi_pico_w-stubs==1.23.0.post2" --no-user
& : The term 'C:\WINDOWS\py.EXE -m pip' is not recognized as the name of a cmdlet, function, script file, or operable 
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:2
+ &"C:\WINDOWS\py.EXE -m pip" install micropython-rp2-rpi_pico_w-stubs= ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\WINDOWS\py.EXE -m pip:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:929:11)
    at Object.execSync (node:child_process:1001:15)
    at Object.execSync (node:electron/js2c/node_init:2:13164)
    at gd (c:\Users\mark\.vscode\extensions\paulober.pico-w-go-4.0.4-win32-x64\dist\extension.cjs:8:60968)
    at async c:\Users\mark\.vscode\extensions\paulober.pico-w-go-4.0.4-win32-x64\dist\extension.cjs:11:57387 micropico.extra.switchStubs {"value":"paulober.pico-w-go","_lower":"paulober.pico-w-go"}

I think C:\WINDOWS\py.EXE would be a valid command, but the -m pip needs to be treated as an argument, not part of the command executable. Possibly related to https://github.com/paulober/MicroPico/issues/215 ? Though that shows as fixed as of April, and included in https://github.com/paulober/MicroPico/pull/217 ?

Which version of MicroPico are you using?

paulober.pico-w-go@4.0.4

Support info

Copy this from the Help -> Info/About -> Copy (Code -> About Visual Studio Code -> Copy on macOS) option in Visual Studio Code:

Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631
paulober commented 2 weeks ago

Sorry for the inconvenience. Just uploaded a patch to fix that issue, thanks for reporting.