My script, utilizing the Popen
module in Python, is encountering an issue where it enters a zombie state intermittently and continues running indefinitely.
try: # Start the subprocess proc = subprocess.Popen(['your_command'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) output = [] while True: # Check if there's any output available to read ready_to_read, _, _ = select.select([proc.stdout], [], [], 0.1) if proc.stdout in ready_to_read: line = proc.stdout.readline() if line: # Process the line print(line, end='') # or do whatever processing you need output.append(line) else: # No more output from subprocess break else: # No output available, do something else or sleep pass # Optionally, wait for the process to finish and collect its return code return_code = proc.wait()
I've provided the path to the batch file here ['your_command'], and within that batch file, I'm invoking the desired Python script. Despite attempting to execute it from the batch script, it's still encountering a halt in execution.