espressif / esptool

Espressif SoC serial bootloader utility
https://docs.espressif.com/projects/esptool
GNU General Public License v2.0
5.6k stars 1.39k forks source link

Failing in a pipx environment (ESPTOOL-966) #1036

Closed wilmer-suarez-simplisafe closed 5 days ago

wilmer-suarez-simplisafe commented 1 week ago

Operating System

Windows 11 VM

Esptool Version

4.8.1

Python Version

3.12.7

Full Esptool Command Line that Was Run

subprocess.check_output("esptool -p COM3 -b 115200 --after no_reset erase_region 0x10000 0x2000", shell=True).decode()

Esptool Output

Exception Output:

CalledProcessError:
esptool -p COM3 -b 115200 --after no_reset erase_region 0x10000 0x2000' returned non-zero exit status 1.

stdout: b''
stderr: None

What is the Expected Behaviour?

I'm running a Python application that is installed using a pyproject wheel with pipx. I'm calling a series of subprocess check_output calls to erase and write to and ESP device. I keep getting the above error.

If I run the application manually/locally in my own virtual environment, it is successful. I've ensured the dependencies are identical.

More Information

Edition - Windows 11 Pro (Virtual Machine) Version - 23H2 OS build - 22631.4460 Experience - Windows Feature Experience Pack 1000.22700.1047.0

Other Steps to Reproduce

No response

dobairoland commented 6 days ago

Hi @wilmer-suarez-simplisafe.

start it with subprocess.run() and without shell=True and you will see the full error output.

But if you use esptool from a Python script then it would be better to import esptool and use it that way without creating separate processes.

wilmer-suarez-simplisafe commented 6 days ago

What would the equivalent calls using esptool directly be? Also, do you know if it's possible to monitor the progress of writing to flash without using subprocess call (that's the main reason I'm using it here)?

dobairoland commented 5 days ago

You can see here an example of using read_flash. You can use others the same way. There is a more comprehensive example in https://github.com/espressif/esptool/pull/1029.

I'm closing this because this is not an esptool issue.