A couple of years back I used the ESP8266_Gmail_SecureSSL example to send emails when triggered by a digital input to a nodeMCU board. This worked well for a while, however I would constantly have to change the gmail setting to allow sending unsecure emails.
Fast forward I no longer use Gmail (new provider) and I needed to change server details in the sketch.
Since then I did a couple of Arduino upgrades (now at 1.8.19) and Win7-64 seems to do some as well (possibly to CP2102 driver?), when I tried to send new sketch to the nodeMCU it would no longer work. Arduino would recognize the serial port when I plugged in the nodeMCU however it failed to accept the sketch upload. This seems like a fairly common problem and after reading countless fixes on the web I have now created another problem. I suspect the original problem might be that the nodeMCU has lost its bootloader (no blinking blue LED) and I have ordered a new nodeMCU to rule that out. In the meantime I have managed to break Arduino IDE such that near the end of the compile I get the error shown below:
It seems to be related to not being able to find Python. I deleted and then reinstalled the nodeMCU board using BoardManager. I also installed an older version of Python in c:\Python27
because some people with this same problem found going to an older version of Python or an older version of nodeMCU solved the problem, however Arduino seems to be looking here for the python code "C:\\Users\\EPC-JRS\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.6.3/tools/signing.py" , so the compiler does not see the python 2.7 and I'm not sure that's the actual problem.
I have tried various ESP8266 boards; nodeMCU, generic etc however they all seem to give the same error.
I have run out of ideas. Help please.
"C:\\Users\\EPC-JRS\\AppData\\Local\\arduino-1.8.19\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\EPC-JRS\\AppData\\Local\\Temp\\arduino_build_306099\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
{runtime.tools.python3.path}/python3 "C:\\Users\\EPC-JRS\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.6.3/tools/signing.py" --mode header --publickey "C:\\Users\\EPC-JRS\\Documents\\Arduino\\Secure-Gmail-master\\ESP8266_Gmail_SecureSSL/public.key" --out "C:\\Users\\EPC-JRS\\AppData\\Local\\Temp\\arduino_build_306099/core/Updater_Signing.h"
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\EPC-JRS\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi
**exec: "{runtime.tools.python3.path}/python3": file does not exist**
**Error compiling for board Generic ESP8266 Module.**
This doesn't help because, on Windows, when you install the ESP8266 boards platform via the Arduino IDE Boards Manager, it also installs a dedicated copy of Python specifically for use when compiling and uploading to ESP8266 boards. The ESP8266 boards platform uses the Python from the location where Boards Manager installs it. It will completely ignore any installations of Python you have anywhere else on your computer.
No, it is looking elsewhere for Python. The path you mention is where a Python script is located. But the error is caused by the IDE not finding the Python installation while trying to execute the script.
I see you are using a very old version of the ESP8266 boards platform (2.6.3). Is there a specific reason you are using that version, or did you just never bother to update to 3.1.2? I don't have any reason to think the version of the platform is the cause of your problem, but using a random version from 3.5 years ago does make it a bit more difficult for the helpers here to provide assistance because we are likely using a different version than you are.
I just tried deleting all instances of the esp8266 boards and reinstalled the latest 3.12 nodeMCU board and I now have a different error as shown below.
FWIW, when I look in this folder, I don't have an encoding subfolder, however when I look at my manually installed c:\Python27 install it does have a encoding subfolder under lib C:\...AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1
"C:\\Users\\EPC-JRS\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\python3\\3.7.2-post1/python3" -I "C:\\Users\\EPC-JRS\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.1.2/tools/mkbuildoptglobals.py" "C:\\Users\\EPC-JRS\\AppData\\Local\\arduino-1.8.19" 10819 "C:\\Users\\EPC-JRS\\AppData\\Local\\Temp\\arduino_build_530496" "C:\\Users\\EPC-JRS\\AppData\\Local\\Temp\\arduino_build_530496/core/build.opt" "C:\\Users\\EPC-JRS\\Documents\\Arduino\\Secure-Gmail-master\\ESP8266_Gmail_SecureSSL/ESP8266_Gmail_SecureSSL.ino.globals.h" "C:\\Users\\EPC-JRS\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.1.2\\cores\\esp8266/CommonHFile.h"
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000026dc (most recent call first):
exit status 3
C:\Users\EPC-JRS\AppData\Local\arduino-1.8.19\arduino-builder returned 3
Error compiling for board NodeMCU 1.0 (ESP-12E Module)
I think this is progress! The platform is now able find its dedicated copy of Python. The error is caused by a missing Python package dependency rather than by Python itself being missing.
If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
After you finish unzipping that file, try compiling the sketch for the ESP8266 board again. Hopefully this time it will be successful.
I'm back to my original problem, I will wait for my new nodeMCU board to arrive and see if the old board is the problem. Have a great day!
esptool.py v3.0
Serial port COM14
Connecting........_____....._____....._____....._____....._____....._____.....____
_
A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header