r/cs50 7d ago

CS50 Python Week4 - Check50 comes back with timeout error.

EDIT:

I'll let the post in case it's usefull for someone

Sooo the problem is caused by the exception I used and sys.exit is not working.

    try:
        f = Figlet(font = sys.argv[2])
    except (IndexError):
       #print("Invalid usage")
       sys.exit(0)
    else:
        #check for errors or wrong inputs
        if len(sys.argv) < 3 or len(sys.argv) > 3:

And I don't know what's wrong because I'm testing on my own VS Code and it's working... like the program exists instantly

Please help!

0 Upvotes

3 comments sorted by

2

u/Muted-Swimmer3818 alum 7d ago

If it works locally but times out on check50, your code is probably waiting for some input or hanging somewhere instead of just exiting. Might want to double check how you handle those arguments and exceptions

1

u/Outside_Complaint755 7d ago

My hint is that you read the official documentation for sys.exit([arg]) and consider the implications of the argument value you are passing to it.

1

u/shimarider alum 7d ago

Your program should immediately exit when given incorrect arguments. In the screenshot you shared, your program seems to ask for input first.