I've been trying to solve this problem for a few hours now. I'm new to Python but I have programming experience in other languages.

Description of my problem:

1) I'm writing a script that will run as a cron job to verify if data transfer is occurring on some legacy hardware.
2) To check if the data transfer I normally issue a command (stcview) and if data transfer is occurring the raw date is output to the terminal. The command has no options and has to be terminated manually. The transfer also lasts for hours at a time so there is a lot of data output.
3) What I'm trying to do is to open a PIPE with subprocess.Popen and close it after a predetermined number of bytes, lines, and/or seconds have passed and check if we have a non zero lenght object.

What seems to be happening

1) Whatever I try Python seems to expecting an EOF on the PIPE before closing it which obviously will not work in this case.
2) I also tried pyping output by sending a bash command via python but again it looks like python is expecting an EOF to close the pype. Also tried Killing the process with the pid I get from subprocess.

System configuration

1) Production machine is Solaris with Python 2.4 (I could update to Python 2.6 if necessary)
2) I'm testing the script on Windows but with Cygwin.

Any suggestions on how to tackle this issue?

Thank you,

Leonard

Thanks Gribouillis. It works great!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.