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

Attempt to open deleted sketch from Sketchbook or Examples menus fails silently #53

Closed
kittaakos opened this issue Feb 24, 2021 · 6 comments · Fixed by #1333
Closed
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

Originally posted by @tigoe here:

Also worth notuing that the Examples menu fails to scan the libraries for examples, as the IDE 1.8.x does. See @ubidefeo 's screenshots to see it.

Context from here:

Screenshots
Screenshot 2021-02-08 at 22 51 52
Screenshot 2021-02-08 at 22 55 44

@kittaakos
Copy link
Contributor Author

@tigoe, can you please tell me what do you mean by Examples menu fails to scan the libraries for examples? Are you missing a few menu items? Which one of them specifically? Thank you!

@rsora rsora transferred this issue from arduino/arduino-pro-ide Mar 1, 2021
@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label Mar 1, 2021
@per1234
Copy link
Contributor

per1234 commented Sep 8, 2021

Closing due to lack of response.

@tigoe if you'll provide the requested information I'll be happy to re-open this issue.

@per1234 per1234 closed this as completed Sep 8, 2021
@tigoe
Copy link
Member

tigoe commented Sep 9, 2021

Sorry for the long delay. Here's how to duplicate what I was seeing:

  1. From your ~/Documents/Arduino/library folder, choose a library that has examples
  2. Check the File -> Examples menu to open an example from that library
  3. Without quitting IDE 2.0, go to the finder
  4. remove the library from the ~/Documents/Arduino/library folder
  5. Go back to the IDE 2.0
  6. Check the File -> Examples menu. The library will still be there, and you can choose an example, but it will not open and will produce no error.

I have tested this with multiple libraries, both those that are imported through the library manager, and those added manually through the Finder. The only solution is to restart the IDE. This was not the behavior of the File -> examples menu in IDE 1.0. It would produce an error that said "The selected Sketch no longer exists. You may need to restart Arduino to update the sketchbook menu"

@tigoe tigoe reopened this Sep 9, 2021
@per1234 per1234 removed the status: waiting for information More information must be provided before work can proceed label Sep 10, 2021
@per1234 per1234 changed the title Examples menu fails to scan the libraries for examples, as the IDE 1.8.x does Attempt to open deleted sketch from Sketchbook or Examples menus fails silently Sep 10, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 29, 2021
@kittaakos
Copy link
Contributor Author

It was fixed for the File > Sketchbook via #1152.

We have to verify it for the libraries.

@per1234
Copy link
Contributor

per1234 commented Jul 27, 2022

I just checked the behavior when attempting to open a deleted library example via the File > Examples menu and unfortunately it still fails silently. So we can not consider this fixed by #1152

@kittaakos kittaakos self-assigned this Jul 27, 2022
@kittaakos
Copy link
Contributor Author

I just checked the behavior when attempting to open a deleted library example via the File > Examples menu and unfortunately it still fails silently. So we can not consider this fixed by #1152

I investigated the problem, and I can confirm that the CLI is caching the examples, so IDE2 needs to re-initialize the client when an example could not be cloned and opened.

Setup:

a.kitta@Akoss-MBP build % ./arduino-cli core list
ID          Installed Latest Name              
arduino:avr 1.8.5     1.8.5  Arduino AVR Boards

a.kitta@Akoss-MBP build % ./arduino-cli lib list 
Name      Installed     Available         Location              Description          
AceButton 1.9.2         -                 LIBRARY_LOCATION_USER -                    

a.kitta@Akoss-MBP build % ./arduino-cli lib list --format json
[
  {
    "library": {
      "name": "AceButton",
      "author": "Brian T. Park \[email protected]\u003e",
      "maintainer": "Brian T. Park \[email protected]\u003e",
      "sentence": "An adjustable, compact, event-driven button library that handles debouncing and dispatches events to a user-defined event handler.",
      "paragraph": "Supported events are Pressed, Released, Clicked, DoubleClicked, LongPressed, and RepeatPressed. Timing parameters, event activation, and event suppression can be configured at compile-time or run-time. Optimized for compact memory consumption. Supports buttons connected directly to digital pins, multiple buttons connected to digital pins through a binary encoder, or multiple buttons connected to analog pins through a resistor ladder.",
      "website": "https://github.com/bxparks/AceButton",
      "category": "Signal Input/Output",
      "architectures": [
        "*"
      ],
      "install_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton",
      "source_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton/src",
      "real_name": "AceButton",
      "version": "1.9.2",
      "license": "Unspecified",
      "location": 1,
      "layout": 1,
      "examples": [
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ArrayButtons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/AutoBenchmark",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/CapacitiveButton",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingBoth",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingReleased",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingSuppression",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded16To4Buttons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded4To2Buttons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded8To3Buttons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/HelloButton",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonCalibrator",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonsTiny",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/MemoryBenchmark",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/PressVersusLongPress",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SimultaneousButtons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButton",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonFast",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonPullDown",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonUsingIEventHandler",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Stopwatch",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfig",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfigFast",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfig",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfigFast",
        "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingTwoButtonConfigs"
      ],
      "provides_includes": [
        "AceButton.h"
      ]
    }
  }
]
a.kitta@Akoss-MBP build % 

gRPC response from the CLI:

18 CALLED: /cc.arduino.cli.commands.v1.ArduinoCoreService/LibraryList
18 |  REQ:  {
18 |    "instance": {
18 |      "id": 1
18 |    }
18 |  }
18 |  RESP: {
18 |    "installed_libraries": [
18 |      {
18 |        "library": {
18 |          "name": "AceButton",
18 |          "author": "Brian T. Park \[email protected]\u003e",
18 |          "maintainer": "Brian T. Park \[email protected]\u003e",
18 |          "sentence": "An adjustable, compact, event-driven button library that handles debouncing and dispatches events to a user-defined event handler.",
18 |          "paragraph": "Supported events are Pressed, Released, Clicked, DoubleClicked, LongPressed, and RepeatPressed. Timing parameters, event activation, and event suppression can be configured at compile-time or run-time. Optimized for compact memory consumption. Supports buttons connected directly to digital pins, multiple buttons connected to digital pins through a binary encoder, or multiple buttons connected to analog pins through a resistor ladder.",
18 |          "website": "https://github.com/bxparks/AceButton",
18 |          "category": "Signal Input/Output",
18 |          "architectures": [
18 |            "*"
18 |          ],
18 |          "install_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton",
18 |          "source_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton/src",
18 |          "real_name": "AceButton",
18 |          "version": "1.9.2",
18 |          "license": "Unspecified",
18 |          "location": 1,
18 |          "layout": 1,
18 |          "examples": [
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ArrayButtons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/AutoBenchmark",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/CapacitiveButton",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingBoth",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingReleased",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingSuppression",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded16To4Buttons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded4To2Buttons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded8To3Buttons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/HelloButton",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonCalibrator",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonsTiny",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/MemoryBenchmark",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/PressVersusLongPress",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SimultaneousButtons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButton",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonFast",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonPullDown",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonUsingIEventHandler",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Stopwatch",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfig",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfigFast",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfig",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfigFast",
18 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingTwoButtonConfigs"
18 |          ],
18 |          "provides_includes": [
18 |            "AceButton.h"
18 |          ]
18 |        }
18 |      }
18 |    ]
18 |  }
18 CALL END

Manually delete one of the examples:

rm -rf /Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons

Click on File > Examples > AceButton > TunerButtons. Received an error over gRPC (expected ✅ )

daemon INFO 68 CALLED: /cc.arduino.cli.commands.v1.ArduinoCoreService/LoadSketch

daemon INFO 68 |  REQ:  {
68 |    "instance": {
68 |      "id": 1
68 |    },
68 |    "sketch_path": "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons"
68 |  }
68 |  ERROR:  rpc error: code = NotFound desc = Can't open sketch: no such file or directory: /Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons
68 |  RESP: null
68 CALL END

IDE2 catches the error and requests the Examples menu rebuilding such as when changing the board, but the CLI provides the same (most likely cached) result:

51 |      {
51 |        "library": {
51 |          "name": "AceButton",
51 |          "author": "Brian T. Park \[email protected]\u003e",
51 |          "maintainer": "Brian T. Park \[email protected]\u003e",
51 |          "sentence": "An adjustable, compact, event-driven button library that handles debouncing and dispatches events to a user-defined event handler.",
51 |          "paragraph": "Supported events are Pressed, Released, Clicked, DoubleClicked, LongPressed, and RepeatPressed. Timing parameters, event activation, and event suppression can be configured at compile-time or run-time. Optimized for compact memory consumption. Supports buttons connected directly to digital pins, multiple buttons connected to digital pins through a binary encoder, or multiple buttons connected to analog pins through a resistor ladder.",
51 |          "website": "https://github.com/bxparks/AceButton",
51 |          "category": "Signal Input/Output",
51 |          "architectures": [
51 |            "*"
51 |          ],
51 |          "install_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton",
51 |          "source_dir": "/Users/a.kitta/Documents/Arduino/libraries/AceButton/src",
51 |          "real_name": "AceButton",
51 |          "version": "1.9.2",
51 |          "license": "Unspecified",
51 |          "location": 1,
51 |          "layout": 1,
51 |          "examples": [
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ArrayButtons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/AutoBenchmark",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/CapacitiveButton",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingBoth",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingReleased",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ClickVersusDoubleClickUsingSuppression",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded16To4Buttons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded4To2Buttons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Encoded8To3Buttons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/HelloButton",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonCalibrator",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/LadderButtonsTiny",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/MemoryBenchmark",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/PressVersusLongPress",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SimultaneousButtons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButton",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonFast",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonPullDown",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/SingleButtonUsingIEventHandler",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/Stopwatch",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfig",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/ThreeButtonsUsingOneButtonConfigFast",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TunerButtons",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfig",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingOneButtonConfigFast",
51 |            "/Users/a.kitta/Documents/Arduino/libraries/AceButton/examples/TwoButtonsUsingTwoButtonConfigs"
51 |          ],
51 |          "provides_includes": [
51 |            "AceButton.h"
51 |          ],
51 |          "compatible_with": {
51 |            "arduino:avr:uno": true
51 |          }
51 |        }
51 |      },

I see two possible solutions:

  • CLI introduces a new flag for the lib list gRPC equivalent. When this flag is true, CLI recalculates the examples.
  • IDE2 should reinitialize the client.

kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Aug 18, 2022
Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Aug 18, 2022
kittaakos pushed a commit that referenced this issue Sep 13, 2022
kittaakos pushed a commit that referenced this issue Sep 13, 2022
kittaakos pushed a commit that referenced this issue Sep 20, 2022
kittaakos pushed a commit that referenced this issue Sep 26, 2022
kittaakos pushed a commit that referenced this issue Sep 27, 2022
kittaakos pushed a commit that referenced this issue Sep 27, 2022
kittaakos pushed a commit that referenced this issue Sep 29, 2022
kittaakos pushed a commit that referenced this issue Oct 4, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants