[SOLVED] Esptool problems uploading ESP8266 project

Hello,
Up to now, I used the Arduino environment for my projects, but now its time to go to GIt, and Platformio appear powerful, so I decided to start this new adventure. I started using platformio some mount ago,
I’ve had got some problems and I tried to adjust theirs by myself. Something I have done but now I don’t know where is the solution. I had installed more and more than one time VSC, Platformio and Python in different versions. now Python is 2.7.13.
The problem born during the Upload of projects using ESP8266, during the build phase I get a successful result, different projects, using this ardware tipe, make the same error.
problem who is:

  • " File “C:\Users\cuogh.platformio\packages\tool-esptoolpy\esptool.py”, line 2848, in *
  • ESP8266ROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b)))"
    NameError: name ‘b’ is not defined
    **** [upload] Error 1

    ----------------------------------------- OTHER INFORMATIONS:------------
    Op. System WINDOWS 10, 64 bit.

Platformio.ini :
slight_smile:[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino

If I try to use the terminal the commands obtain error eg :slight_smile:
“$ pio
bash: pio: command not found”

Many thanks for your support
Ciao
Daniele

Can you check in C:\Users\cuogh\.platformio\packages\tool-esptoolpy\esptool.py. Does line 2848 really read:

ESP8266ROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b)))"

Because it should read:

ESP8266ROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b"""

Hi Manuelbl,
Thanks for the attention to my problem,
the file contain inline 2847 and the next this, the same that you wrote:

 # Binary stub code (see flasher_stub dir for source & details)

ESP8266ROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b)))

really exactly (upload://1YNp6xPYDl1qqn51gozNKqFEG3Y.png)
as you can see in the liked image there is a marker down the b letter. I don’t know what it mean
BR
Daniele

If you don’t have the same code as we have with the latest version I’d recommend deleting the C:\Users\<user>\.platformio\packages\tool-esptoolpy folder, then opening a PIO terminal and type

pio upgrade --dev
pio platform update

And restart VSCode. You should have the latest PIO version along with the latest platforms. Is the error still there?

2 Likes

SOLVED
Now I can’t connect COM5 , but is a local problem, I hope.
Many Thanks,
BR
Daniele

1 Like