Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stderr empty when calling esptool with subprocess.Popen (ESPTOOL-696) #888

Open
Waganama opened this issue Jun 9, 2023 · 1 comment
Open

Comments

@Waganama
Copy link

Waganama commented Jun 9, 2023

Operating System

Python

Esptool Version

V4.6.1

Python Version

Python 3.11

Full Esptool Command Line that Was Run

esptool -p COM9 --chip esp32 read_mac

Esptool Output

STDOUT : b'esptool.py v4.6.1\r\nSerial port COM9\r\nConnecting......................................\r\n\r\nA fatal error occurred: Failed to connect to ESP32: No serial data received.\r\nFor troubleshooting steps visit:

https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html\r\n'

STDERR : b''

What is the Expected Behaviour?

STDOUT : b'esptool.py v4.6.1\r\nSerial port COM9\r\nConnecting......................................\r\n\r\n

STDERR : b''A fatal error occurred: Failed to connect to ESP32: No serial data received.\r\nFor troubleshooting steps visit:

https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html\r\n'"

More Information

Hello guys,
I tried to catch esptool error in stderr from subprocess.Popen with the following code :

def read_mac(self, port) :
command = [ESPTOOL_PY, '-p', port, '--chip', 'esp32', 'read_mac']
send_command(command)

def send_command(command: list[str]) :
out = subprocess.Popen([sys.executable] + command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
stdout, stderr = out.communicate()

print(f'STDOUT : {stdout}')
print(f'STDERR : {stderr}')

Thanks for your help :)

Other Steps to Reproduce

No response

@github-actions github-actions bot changed the title Stderr empty when calling esptool with subprocess.Popen Stderr empty when calling esptool with subprocess.Popen (ESPTOOL-696) Jun 9, 2023
@radimkarnis
Copy link
Collaborator

Hi @Waganama,
thanks for the ticket!

It will be implemented as a part of the next major release (v5.0) since it is a breaking change for current scripts relying on reading the stdout output.

I will keep this open until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants