Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Rollback to Revision 2
Source Link
MisterMiyagi
  • 53.4k
  • 14
  • 131
  • 138

LIve Live output status from subprocess command Error:I/O operation on closed file. Python

I'm writing a script to get netstat status using subprocess.Popencheck_output.

cmd = 'netstat -nlpt | grep "java" | grep -v tcp6'nlpt' result1 result = subprocess.Popencheck_output(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True ) stdout, stderr=result1.communicate(timeout=1800) for line in iterprint(result1result.stdout): printdecode(line'utf-8')) 

The above giving out ValueError: I/O operation on closed fileis running perfectly. Is Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using writenpopen here i just need to print live status.but i'm using check_output please some one help me on this issue. Thank you!

LIve status from subprocess command Error:I/O operation on closed file. Python

I'm writing a script to get netstat status using subprocess.Popen.

cmd = 'netstat -nlpt | grep "java" | grep -v tcp6' result1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True ) stdout, stderr=result1.communicate() for line in iter(result1.stdout): print(line) 

The above giving out ValueError: I/O operation on closed file. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using writen here i just need to print live status. please some one help me on this issue. Thank you!

Live output status from subprocess command Python

I'm writing a script to get netstat status using subprocess.check_output.

cmd = 'netstat -nlpt'  result = subprocess.check_output(cmd, shell=True, timeout=1800) print(result.decode('utf-8')) 

The above is running perfectly. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using popen but i'm using check_output please some one help me on this issue. Thank you!

added 189 characters in body; edited tags
Source Link

Live output LIve status from subprocess command Error:I/O operation on closed file. Python

I'm writing a script to get netstat status using subprocess.check_outputPopen.

cmd = 'netstat -nlpt' nlpt | grep "java" | grep -v tcp6' resultresult1 = subprocess.check_outputPopen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, timeout=1800universal_newlines=True ) print(result stdout, stderr=result1.decodecommunicate('utf-8') for line in iter(result1.stdout): print(line) 

The above is running perfectlygiving out ValueError: I/O operation on closed file. Is Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using popen but i'm using check_outputwriten here i just need to print live status. please some one help me on this issue. Thank you!

Live output status from subprocess command Python

I'm writing a script to get netstat status using subprocess.check_output.

cmd = 'netstat -nlpt'  result = subprocess.check_output(cmd, shell=True, timeout=1800) print(result.decode('utf-8')) 

The above is running perfectly. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using popen but i'm using check_output please some one help me on this issue. Thank you!

LIve status from subprocess command Error:I/O operation on closed file. Python

I'm writing a script to get netstat status using subprocess.Popen.

cmd = 'netstat -nlpt | grep "java" | grep -v tcp6' result1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True )  stdout, stderr=result1.communicate() for line in iter(result1.stdout): print(line) 

The above giving out ValueError: I/O operation on closed file. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using writen here i just need to print live status. please some one help me on this issue. Thank you!

Post Closed as "Duplicate" by Maurice Meyer, MisterMiyagi, RoadRunner python
added 142 characters in body
Source Link

I'm writing a script to get netstat status using subprocess.check_output.

cmd = 'netstat -nlpt' result = subprocess.check_output(cmd, shell=True, timeout=1800) print(result.decode('utf-8')) 

The above is running perfectly. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using popen but i'm using check_output please some one help me on this issue. Thank you!

I'm writing a script to get netstat status using subprocess.check_output.

cmd = 'netstat -nlpt' result = subprocess.check_output(cmd, shell=True, timeout=1800) print(result.decode('utf-8')) 

The above is running perfectly. Is there any way to get the live-streaming output. I have heard poll() function does this job. please some one help me on this issue. Thank you!

I'm writing a script to get netstat status using subprocess.check_output.

cmd = 'netstat -nlpt' result = subprocess.check_output(cmd, shell=True, timeout=1800) print(result.decode('utf-8')) 

The above is running perfectly. Is there any way to get the live-streaming output. I have heard poll() function does this job. In live output from subprocess command they are using popen but i'm using check_output please some one help me on this issue. Thank you!

Source Link
Loading