Pretty certain I’m going to kick myself when I find out what I did wrong here but I am stumped and my Google-fu is not working.
When I try to compile, it will not link:
*** [.pio\build\d1_mini\firmware.elf] Implicit dependency `C:\Users\xxxxxxx\.platformio\platforms\espressif8266\builder\python' not found, needed by target `.pio\build\d1_mini\firmware.elf'.
Python 2.7 is in my %PATH% (this is Windows) and when I type “python” in the terminal it starts fine. When I look in C:\Users\xxxxx\.platformio\platforms\espressif8266\builder\ I see main.py but no “python” as it seems to be looking for.
This is a new install, new machine, so I clearly forgot something I did in the past. Any ideas?
Does this happen on the most recent PlatformIO version? (open PIO terminal, pio upgrade --dev, get 4.0.4a1, restart vscode). Are there more system environment variables set regarding python?
The most recent release, yes. I installed 4.0.4a1 and restarted with the same issues.
PS C:\Users\Foo\OneDrive\Desktop\Xxxxxx\Git\xxxxxx> pio upgrade --dev
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 4.0.4a1
Release notes: https://docs.platformio.org/en/latest/history.html
Just for grins I uninstalled Python 3.x and 2.7, PlatformIO and VSCode. I reinstalled Python 2.7 (added it to path), then VSCode, then PlatformIO. Same issue.
I do, and generally it warns me when it does that.
I turned off AV and had another go - same issues. I had a look at my platformio.ini and remembered I have a couple of scripts called in there. I commented those out and things compile. This is perplexing because those scripts have been in my project a while. I call them with this line in the ini:
build_flags = python git_rev.py
And the script is fairly simple:
#!/usr/bin/python
import subprocess
# Get 0.0.0 version from latest Git tag
tagcmd = "git describe --tags --abbrev=0"
version = subprocess.check_output(tagcmd, shell=True).decode().strip()
# Get latest commit short from Git
revcmd = "git log --pretty=format:'%h' -n 1"
commit = subprocess.check_output(revcmd, shell=True).decode().strip()
# Get branch name from Git
branchcmd = "git rev-parse --abbrev-ref HEAD"
branch = subprocess.check_output(branchcmd, shell=True).decode().strip()
# Make all available for use in the macros
print("-DPIO_SRC_TAG={0}".format(version))
print("-DPIO_SRC_REV={0}".format(commit))
print("-DPIO_SRC_BRH={0}".format(branch))
As you point out it’s something I did, I’m just not sure what.
Bitdefender. And as long as we’re talking about it I find it highly performant, however it has a feature called “Safe Files” which is intended to protect against ransomware and the like which is highly annoying if you are developing. Like other products it tells you it blocked the process, and then you can whitelist it, but if you upgrade your tools it sees that as a different application so you go through it over again. I’d love to be able to exclude certain folders.
I did figure out my issue, not sure how I did it, and not sure why this is a “thing”:
If you look at the line from my ini I have build_flags = python git_rev.py but it should be build_flags = !python git_rev.py. So it was something I did somehow.