#๐Ÿ”’ Subprocess readline problem

14 messages ยท Page 1 of 1 (latest)

queen wraithBOT
#

@pseudo harbor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

pseudo harbor
#
f = "binmaster-slayer-win.exe"

def execute(f):
    process = Popen(f, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, encoding="utf8") 
    process.poll()
    print("Running Binmaster-Slayer...")
    while True:
        nextoutline = process.stdout.readline()
        nexterrline = process.stderr.readline()
        print(nextoutline)
        if 'Stall detected but the heartbeat check is still active!' in nextoutline and process.poll() is not None:
            print("Restarting Binmaster-Slayer because of stalling...")
            process.kill()
            time.sleep(5)
            execute(f)
        elif 'Uncaught Exception:' in nexterrline and process.poll() is not None:
            print("Restarting Binmaster-Slayer because of Uncaught Exception Error...")
            process.kill()
            time.sleep(5)
            execute(f)
            
execute(f)
#

Thing is I want to restart the program after these error messages pop up

#

But it's not reading them properly smh or smth else went wrong

tulip narwhal
#

If you keep making new threads then you're going to be wasting a lot of time explaining context to people.

pseudo harbor
#

yeah you're right but the old one is really down there

#

Noone's gonna see it

#

I'll close it anyways

tulip narwhal
#

If you link it in the general discussion people would see it

pseudo harbor
#

๐Ÿ‘

#

yep

queen wraithBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Subprocess readline problem