T
T
The-TS2021-08-09 11:55:17
Python
The-TS, 2021-08-09 11:55:17

How to catch gunicorn's STDOUT?

Hey!

In this question, the Python tag curator donated the subprocess library . Here is my code:

with Popen(['gunicorn', 'TS.wsgi', '-b', 'localhost:65535', '--log-level', 'debug'], stdout=PIPE) as p:
                for line in iter(p.stdout.readline, b''):
                    print(f">>> {line.decode()}")
                p.stdout.close()
                p.wait()

Only there is one problem, Gunicorn started up and showed the text (in the terminal) without >>>, looked through debug and I suspect that p.stdout.readline has no data at all.
How to fix it?

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-08-09
@Pyhon3x

Are you sure it's stdout? Look in p.stderr.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question