I want to pass output from one python script into another one as in
python -c $'print("world")' | python -c $'import sys \nprint("hello " + sys.stdin.readline())'
which works quite well.
Now the first one is to be replaced to have
mbed detect | python -c $'import sys \nprint("hello " + sys.stdin.readline())'
This yields an error
hello
Traceback (most recent call last):
File "C:\Users\ere\...\mbed-os\tools\detect_targets.py", line 90, in main
print(mcu_toolchain_matrix(platform_filter=mut['mcu']))
OSError: [Errno 22] Invalid argument
On the other hand, mbed detect
invoked alone yields reasonable output.
The mbed tool is installed via pip install mbed-cli
and as i can see installation creates a file mbed.exe
.
This means it is an application written in python and compiled into an exe.
Maybe that latter is the step where piping gets broken???
I can see in the stacktrace that problem occurs in the source with print("")
print("")
print("[mbed] Detected %s, port %s, mounted %s, interface "
"version %s:" %
(mut['mcu'], mut['port'], mut['disk'], interface_version))
print("[mbed] Supported toolchains for %s" % mut['mcu'])
#print(mcu_toolchain_matrix(platform_filter=mut['mcu']))
count += 1
Note that i commented out another print. If i dont, that problem occurs at that place. Very strange..
Help very much appreciated.