I have been using PlatformIO for a year or two and I had to rebuild my laptop. After installing Visual Studio Code and the PlatformIO extension I created a simple sketch please see below
#include <Arduino.h>
void setup()
{
Serial.begin(115200);
}
void loop()
{
Serial.println(" Hello ");
delay(1000);
}
I compiled it first and then uploaded it and it gave me the following error
*** [upload] UnboundLocalError : local variable ‘port’ referenced before assignment
Traceback (most recent call last):
File “C:\Users\andre.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Action.py”, line 1318, in execute
result = self.execfunction(target=target, source=rsources, env=env)
File “C:\Users\andre.platformio\platforms\espressif32\builder\main.py”, line 35, in BeforeUpload
env.AutodetectUploadPort()
File “C:\Users\andre.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py”, line 737, in call
return self.method(*nargs, **kwargs)
File “C:\Users\andre.platformio\penv\lib\site-packages\platformio\builder\tools\pioupload.py”, line 113, in AutodetectUploadPort
UPLOAD_PORT=SerialPortFinder(
File “C:\Users\andre.platformio\penv\lib\site-packages\platformio\device\finder.py”, line 156, in find
return best_port or port
UnboundLocalError: local variable ‘port’ referenced before assignment
I have tried uninstalling and PlatformIO and VSCode but no joy, I even reinstalled windows 10, if any kind soul could help I would really appreciate it I don`t want to have to go back to the alternative.
PS I was uploading to a ESP32 which again I have done a hundred time before
Thank you in advance
Andrew