PlatformIO Community

VSCode / PIO - Could not initialize project - can't create files/folders

New user : using VSCode / PlatformIO
PIO 5.0.4
VSC 1.52.1

Using Project Wizard to Create new …
Enter Project name, DOIT ESP32 …, Arduino
Gives “could not initialize project” error

“Server error: {“type”:“FileNotFoundError”,“args”:[2,“The system cannot find the file specified”],“message”:”[WinError 2] The system cannot find the file specified: ‘C:\\Users\\Dell\\Documents\\PlatformIO\\Projects\\test4’"}

Before this, it complained, unable to find “PlatformIO”
So created it manually
Then it complained, unable to find “projects”
So I created it manually
Etc etc

But it seems it is unable to create files for some reason ?
So I have started VSC with Admin rights - but no change

Any suggestions please ?

===========================================
This is error once I have manually created “projects\test4” and then try to create a new project called “test4”

PIO Core Call Error: 
The current working directory C:\Users\Dell\Documents\PlatformIO\Projects\test4 will be used for the project.

The next files/directories have been created in C:\Users\Dell\Documents\PlatformIO\Projects\test4
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File


Error: Traceback (most recent call last):
 File "c:\users\dell\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
 cli() # pylint: disable=no-value-for-parameter
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
 return self.main(*args, **kwargs)
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
 rv = self.invoke(ctx)
 File "c:\users\dell\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
 return super(PlatformioCLI, self).invoke(ctx)
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
 return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
 return ctx.invoke(self.callback, **ctx.params)
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
 return callback(*args, **kwargs)
 File "c:\users\dell\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
 return f(get_current_context(), *args, **kwargs)
 File "c:\users\dell\.platformio\penv\lib\site-packages\platformio\commands\project.py", line 179, in project_init
 init_base_project(project_dir)
 File "c:\users\dell\.platformio\penv\lib\site-packages\platformio\commands\project.py", line 227, in init_base_project
 config.save()
 File "c:\users\dell\.platformio\penv\lib\site-packages\platformio\project\config.py", line 468, in save
 with open(path or self.path, "w+") as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Dell\\Documents\\PlatformIO\\Projects\\test4\\platformio.ini'

\n============================================================\r\n\r\nAn unexpected error occurred. Further steps:\r\n\r\n* Verify that you have the latest version of PlatformIO using\r\n `pip install -U platformio` command\r\n\r\n* Try to find answer in FAQ Troubleshooting section\r\n https://docs.platformio.org/page/faq.html\r\n\r\n* Report this problem to the developers\r\n https://github.com/platformio/platformio-core/issues\r\n\r\n

OK - I should declare some previous history …

The reason for me to move to PlatformIO was due to an error when using the Arduino IDE
Here the IDE was losing access to the source file after a compile process preventing further editing
As reported here

So in same way tried VSC/PlatformIO on a borrowed laptop
And it works OK

So there is something blooming odd happening on my PC
But no idea what, since no other applications have any issues on this pc opening files etc, just these two

Looks like I’m going to have to bite the bullet and do a clean OS rebuild

Is your antivirus maybe out of control? Can you temporarily disable it?

Is that folder then really gone? Harddrive is failing?

Thanks for your ideas

Because I needed to get on, I did a Windows rebuild on new drive to resolve

But I still have the original drive, and if I get time I will maybe have a look again

“Is your antivirus…”
Only Anti Virus in use was std Windows 10 stuff - but I hadn’t tried it with it switched off

" Is that folder then really gone ?"
Don’t believe so, as at each step of PlatformIO error I was able to manually create the folder it said was missing - The go back and try to create the same named New Project and it would then complain it couldn’t create the next required sub folder
1st had to manually create Projects, then Test4 etc ( tried with a number of Testn projects - same result