Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Stubs resulted in an error #227

Closed
wtakuo opened this issue Jun 21, 2024 · 1 comment · Fixed by #231
Closed

Switch Stubs resulted in an error #227

wtakuo opened this issue Jun 21, 2024 · 1 comment · Fixed by #231
Assignees
Labels
bug Something isn't working

Comments

@wtakuo
Copy link
Contributor

wtakuo commented Jun 21, 2024

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

What are the steps to reproduce this issue?

  1. Start command "MicroPico:Extra > Switch stubs"
  2. In "Select the stubs port you want to use" menu, choose an arbitrary port other than "Included"
  3. In "Select the stubs version you want to use" menu, choose an arbitrary version

What happens?

What were you expecting to happen?

For example, if we select port ESP32 version 1.23.0.post1, the following error dialog will appear.
Similar results are obtained for the other combinations.
Screenshot_2024-06-21 0 10 31

Any logs, error output, etc?

(To get extension logs see Terminal > Output > Extension Host and copy output concerning pico-w-go or micropico)
(If it’s long, please paste to https://gist.github.com and insert the link here)

024-06-21 23:53:04.043 [error] Error: Command failed: "/Users/takuo/.pyenv/shims/pip3" install 1.23.0.post1==undefined --target "/Users/takuo/.micropico-stubs/1.23.0.post1==undefined" --no-user
ERROR: Could not find a version that satisfies the requirement 1.23.0.post1==undefined (from versions: none)
ERROR: No matching distribution found for 1.23.0.post1==undefined

    at checkExecSyncError (node:child_process:928:11)
    at Object.execSync (node:child_process:1000:15)
    at Object.execSync (node:electron/js2c/node_init:2:13035)
    at installStubsByVersion (/Users/takuo/local/src/MicroPico/src/stubs.mts:336:18)
    at /Users/takuo/local/src/MicroPico/src/activator.mts:1156:30 micropico.extra.switchStubs {"value":"paulober.pico-w-go","_lower":"paulober.pico-w-go"}

Any other comments?

Perhaps the cause is that in the following code (activator.mts, lines 1121-1130), the value of Object.keys( availableStubVersions).length is always 1 because the type of availableStubVersions is {[key: string]: string[]}.

          Object.entries(availableStubVersions).forEach(([key, values]) => {
            // Map each value to "key - value" and push to resultArray
            versions.push(
              ...values.map(value =>
                Object.keys(availableStubVersions).length > 1
                  ? `${stubPortToDisplayString(key)} - ${value}`
                  : value
              )
            );
          });

This causes versions to be just a list of version number strings, and in the following code (activator.mts, line 1152), versionParts is set to a different value than expected.

              const versionParts = version.split(" - ");

The above code can be changed as follows to achieve the expected behavior.

          Object.entries(availableStubVersions).forEach(([key, values]) => {
            // Map each value to "key - value" and push to resultArray
            versions.push(
              ...values.map(value =>
                `${stubPortToDisplayString(key)} - ${value}`
              )
            );
          });

Which version of MicroPico are you using?

3.7.8

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.90.2 (Universal)
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:37:41.291Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0
@wtakuo wtakuo added the bug Something isn't working label Jun 21, 2024
@paulober
Copy link
Owner

@wtakuo Thanks for taking the time to report this bug in this very detailed issue and providing a PR to fix it ASAP.
I'm sorry that you had this bug, it should have definitely get caught during testing.
I'll include your fix in the next patch which will be released today.

paulober added a commit to wtakuo/MicroPico that referenced this issue Jun 22, 2024
paulober added a commit that referenced this issue Jun 22, 2024
@paulober paulober mentioned this issue Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants