Page 1 of 1

esptool: FileNotFoundError: [Errno 2] No such file or directory

Posted: Fri Jan 05, 2024 4:45 pm
by _kaktus_
Hello.

I am new to working with ESP modules and lack experience in handling them. Therefore, I am seeking guidance on how to solve the problem as I have been unable to do so on my own.

I use Debian GNU/Linux trixie/sid (KDE/plasma) on a daily basis and have installed the esptool from the repository to manage the module.

Code: Select all

$ apt search esptool
Sorting... Gotowe
Full Text Search... Gotowe
esptool/testing,testing,now 4.6.2+dfsg-0.1 all [installed]
  create and flash firmware files to ESP8266 and ESP32 chips
When he executes the command:

Code: Select all

$ esptool -p /dev/ttyUSB0 -b 460800 read_flash 0 ALL flash_ESP32-CAM.bin
I get a response and some errors:

Code: Select all

esptool.py v4.6.2
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: fc:b4:67:01:c2:00
Traceback (most recent call last):
  File "/usr/bin/esptool", line 37, in <module>
    esptool._main()
  File "/usr/lib/python3/dist-packages/esptool/__init__.py", line 1073, in _main
    main()
  File "/usr/lib/python3/dist-packages/esptool/__init__.py", line 717, in main
    esp = esp.run_stub()
          ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/esptool/loader.py", line 956, in run_stub
    stub = StubFlasher(get_stub_json_path(self.CHIP_NAME))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/esptool/loader.py", line 159, in __init__
    with open(json_path) as json_file:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3/dist-packages/esptool/targets/stub_flasher/stub_flasher_32.json'
Have any of you been in a similar situation and know the solution :idea: Or can someone point you in the right direction :?:

Best regards

Re: esptool: FileNotFoundError: [Errno 2] No such file or directory

Posted: Sun Jan 07, 2024 2:09 pm
by Dennis1
I have the exactly same error, but don't know what to do. Did you find the solution to it?

Re: esptool: FileNotFoundError: [Errno 2] No such file or directory

Posted: Mon Jan 08, 2024 7:48 am
by ESP_Roland
This is a Debian issue. The maintainer who made the esptool package forgot to add the JSON files into the package archive. This should be reported in the Debian issue tracker.

However, you can install esptool without the Debian package manager and you will get the latest version: https://docs.espressif.com/projects/esp ... ation.html

Re: esptool: FileNotFoundError: [Errno 2] No such file or directory

Posted: Tue Jan 09, 2024 7:46 pm
by _kaktus_
Hello. :mrgreen:

Yes that's right it's a package problem for Debian.
It has already been reported in traker.
One solution is to copy the missing files from the esptool project's GitHub.

@Dennis1 It worked for me.

Code: Select all

$ esptool -p /dev/ttyUSB0 -b 460800 read_flash 0 ALL flash_ESP32-CAM.bin
esptool.py v4.6.2
Serial port /dev/ttyUSB0
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: fc:b4:67:01:c2:00
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Detected flash size: 4MB
4194304 (100 %)
4194304 (100 %)
Read 4194304 bytes at 0x00000000 in 100.6 seconds (333.5 kbit/s)...
Hard resetting via RTS pin...
Greetings ;)