Added SSID, password, Bintray API token to the system environment (/etc/profile), and it is showing up as a variable.
Edited the platformio.ini file with my project’s properties.
Changed to release and uploaded, and all this resulted in the error mentioned above.
Observation
Upon following the link, which was in the error output, there was a plain text saying {"message":"Package '' was not found"}. I tried changing the publish_firmware.py file by commenting out the "content" at the end of line 48. On that link, I got a login prompt, where I put in my password and username, but it doesn’t allow me in.
Maybe you can recheck your steps there and see the error? "message":"Package '' was not found"} sounds to me like some package name or URL wasn’t properly configured.
Okay, weird. I’ll setup my own account and follow the instructions step-by-step and see if I encounter the same error.
I don’t know whether that’s supposed to be there or if it wasn’t able to substitute the environment vairable properly. But if the token wasn’t right I guess you would be getting an “Unauthorized” error, not a “does not existt” error? Still, try and replace this in the platformio.ini with a constant value.
I changed it manually to my token, and it pushed the update to my Bintray. Even though this might not be the fix for everyone, it is definitely for me. Thank you so much.
If you could figure out why it doesn’t read my system environment there, that would be the true solution. I just want to let you know, I put the SSID and the password in my system environment, and that is being read.
According to the documentation that should work. How and in which shell have you exported the environment variable? Maybe it just isn’t visible when PlatformIO is run in a new shell? THat’s very OS-dependent…
PlatformIO is Python 3.x program and current Python 2.7 support is deprecated and will be removed. If you are using PlatformIO from within VSCode and the upload button there, it will internally use its own Python 3.7 installation. You can start a PIO terminal and execute pio system info to see for youself.
But you’re absolutely right, if it worked for all other 3 environment variables (SSID, PW, bintray token) there and it only works for 3, I don’t know why… Maybe when the firmware is compiled it is done so under the full system environment and when it executes the upload SCons script, it started in a minimalistic environment where these things are not read out? The other possibility would be a typo in the environment.
You can check what’s going on there by adding more debug statements to the python publish firmware script, see here. Things like
I can find the BINTRAY_API_TOKEN in the print(os.environ) output, but the print(env) output is <SCons.Script.SConscript.SConsEnvironment object at 0x101f26e20> which is kinda weird.
Like why doesn’t the firmware want to read my system environment variable? The best option here for me is to just make a .gitignore for my platformio.ini and just use the token manually. Not exactly the comfiest setup, I’d say.
Ah, thank you. Well, there is a BINTRAY_API_TOKEN in the dump, but I just went with my solution. Maybe, I’ll make my own OTA fork with this change later.