Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to prevent a Python program from timing out (with exit code 9)

+5 votes
asked Feb 16, 2021 by Jeff The Chicken (2,920 points)

I Have made a Python text-only game that basically loops endlessly until the player dies. It is flawless and runs smoothly, but eventually, it times out and gives me an exit code 9. Is there anything I can do to change that?

1 Answer

+1 vote
answered Feb 17, 2021 by Peter Minarik (86,040 points)
selected Feb 17, 2021 by Jeff The Chicken
 
Best answer

If it works all right here, on Online GBD, can you try to install Python on your own PC and try to run it there?

This test would verify if this is a behaviour specific to Online GBD (preventing users to hog resources for a long time) or it's Python, or maybe something is not OK with the code itself.

Update

I did the same thing: ran a simple code on both Online GBD and on a physical virtual machine. The Online GDB code timed out, while the one running on my machine still keeps running (and waiting for user input).

It looks like my suspicion was correct: it's Online GDB trying to keep the resource usage low.

For the record, this is the code I ran, nothing interesting, nothing demanding:

name = input("What's your name? ")
print("Your name is: " + name)

commented Feb 17, 2021 by Jeff The Chicken (2,920 points)
do you have a stack overflow account?
commented Feb 17, 2021 by Peter Minarik (86,040 points)
I do.

Last time I commented/asked questions there it was work related.

OnlineGDB is more like hobby, nothing work related for me. Well, at least in the questions section. I used the editor/compiler at work to test some simple code.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...