#18837·micropython

Enabling DUPTERM on Unix kills output to stderr

Author: m-u-xyzCreated Feb 18, 2026Updated Sep 26, 2026
Labelsbugport-unix

Port, board and/or hardware

Unix

MicroPython version

current master, v1.27.0-175-ga8b71559cf-dirty

Reproduction

Adding

#define MICROPY_PY_OS_DUPTERM (2)

to ports/unix/mpconfigport.h disables writing to standard error. Output is sent to stdout instead.

Expected behaviour

$ ports/unix/build-standard/micropython -c "import sys;print('XXX',file=sys.stderr)" >/dev/null
XXX
$ 

Observed behaviour

$ ports/unix/build-standard/micropython -c "import sys;print('XXX',file=sys.stderr)" >/dev/null
[ no output ]
$ 

Additional Information

>>> import sys
>>> sys.stdout
<io.TextIOWrapper 1>
>>> sys.stderr
<io.TextIOWrapper 2>

but print or write don't seem to care.

Code of Conduct

Yes, I agree