(Jun-26-2018, 09:31 AM)volcano63 Wrote: You can can try reading fromself.proc.stdout
till you get your device in the output - and then kill the process.
for line in self.proc.stdout: if <> in line: self.proc.kill()(I think).
The problem is - it may get stuck. And what happens if the device never shows up?
I used to writestdout
to a filestdout=open(<log name>, 'w')
- and then periodically look-up the file content in a loop, and leaving the loop after some maximum number of attempts.
I tried that but I cannot actually read the stream in the first place.
I also tried saving to a file.
In both cases, It will save to a file/list no problem but only AFTER the CTRL+C command is pressed.
kill etc does not allow save anything!
I can only capture the data after the CTRL+C is issued. Before that I get nothing.
It is buffered data and seems to be in memory until CTRL+C and then it spits out what is there!
(Jun-26-2018, 09:31 AM)Larz60+ Wrote: can you do it if a variable?
ctrlc = chr(5)
then issue ctrlc?
Yes, it is also possible but This is not the issue.
I need to read the data and save to a variable before the CTRL+C command is issued