
I’m created an workspacefolder “pyArduino” for using communication between Python and Arduino nano.
1.) Added Python virtual Environment in this workspacefolder as “pyard”, activate it and wrote Phython code.
2.) Generate a Arduinoproject in this workspace with PlatformIO.
3.) Compile and upload to the microcontroller.
4.) Added more Arduinoprojects.
All worked fine!
Then i closed the Workspacefolder and opened another Folder. Going back to my workspace “pyArduino”, all my created Arduino Project are gone. I opened the PlatformIO and added missed Projects again. Even now the Terminal shows again the Name of the virtual environment.
All works fine again!
Testet: changing the workspacefolder by ‘close Folder’ and ‘open another folder’, open my pyArduino folder again, same solution, all arduino Projects are gone!
What do i wrong? Can anybody assist?
Thanks
Helmut
I don’t use workspaces very much in VSCode, I like to just open folders instead. However, I notice there’s an option to “save workspace as” – I assume you did save your workspace?
Workspaces are actually helpful when you have files in other places, so you can open a workspace, the add files and folders from all over your hard disc, and magically (!) they will appear to all be located in the workspace. It’s an illusion.
They are still all over the place on your hard drive.
If you saved the workspace, then the files will (should) appear there next time you open that workspace. If you didn’t, then you’ll have to add them all over again – they should still exist on your hard disc, you just need to find them.
Two problem’s I have found with the latest VSCode on Linux:
-
File->Add folder to workspace opens the file selector behind the main VSCode window. Sigh!
- Closing VSCode without saving the workspace doesn’t prompt me to save the workspace.
However, cloning the workspace does prompt me to save.
I wonder if any of your problems with vanishing projects are related?
HTH
Cheers,
Norm.
Hello Norm,
thanks for your answer
.
But sorry, this dosen’t help to solve my Problem. I’m added no folders from anwhere to the workspace. My Arduino-Projects are created direkt in my “Workspacefolder” with PlatformIO. The entries from the projects are all korrekt in the “pyArduino.code-workspace” file.
Greetings
Helmut
Hi Helmut.
This sounds quite strange. I’m not a fan of Python virtual environments myself, so I don’t use them. I wonder if that is somehow resposible in some way. You say that initially you activated the venv and all was well, did you activate it again after changing workspaces? Is that actually required or does the venv remain activated until closed?
I can’t undrstand why files snd folders eould vanish simply because VSCode switched folders. It’s puzzling.
Sorry I’m no help.
Cheers,
Norm.
Hi Norm,
i’ll think i’ve solved my problem.
It was my mistake. I closed the workspacefolder, changed to another folder and then i changed back to my workspacefolder with “open folder” instead through open by “open workspace by file”. Then the Arduino Projects are not available. When opening the workspace by the workspacefile all works fine!
Sometimes the problem is sitting before the monitor. 
Thanks for help
Helmut
1 Like
I’m so glad you found the problem, that one was a little too weird for me! 
Cheers,
Norm.