Jun-27-2018, 07:48 AM
(Jun-27-2018, 07:39 AM)volcano63 Wrote:(Jun-27-2018, 05:59 AM)maffaz Wrote: Interesting! That is golden advice even if it does not work..
The ping example works fine with stdout but not the tool in question.
I am not at my computer until this evening and I will try it then but that is certainly something I have not tried as of yet!
I must stress that it is a windows CLI Tool but the beauty of subprocess is that it is cross platform.
Is there anything to consider if its windows?
Did you try to setstderr=subprocess.STDOUT
? Some apps send output tostderr
- don't ask me why, but I saw it happening, especially with HW-oriented apps.
One more thing I have forgotten (I haven't usedsubprocess
for several months) - by default its output isbytestrings
,universal_newlines=True
forces its output to unicode strings.
If you run your command in terminal, does it provide continuous output - or only after you stop it? In the former case, my approach should work
If i run it in a command it will print the output to the screen until CTRL+C is pressed. Then it will exit and the data remains.
It is a HW orientated app. It is a dongle that communicates with a Temperature sensor written in C using a Serial(com) port via USB.
There can be many in range and i am writing a program that will iterate through each one and update the firmware if necessary.
The program works fine except for only being able to obtain the data by using a timer and reviewing the output presented after it closes.
I will try this evening when I return home as I have not yet tried your suggestion.
Indeed where I am, it works fine with ping but also with stdout.