> >>> f = os.popen2('ping 192.168.8.85 -c 100 > cap1.txt')
> >>> f[0].write('\x03')
> 
> Thank command works, but 'f[1]' is in read-only mode and I can't write 
> to it.
> My command in the background is still not terminated.

Thats almost certainly because ping never reads its input.
In that case you'll need to send a kill signal to the process and
to do that you need to find the process ID. I'm not sure if 
popen() provides access to the PID but if not you could 
either search for it (this might be too slow) or just drop 
down to use fork rather than popen, as fork will return 
the PID.


Alan G.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to