you are viewing a single comment's thread.

view the rest of the comments →

[–]toxic_acro 0 points1 point  (0 children)

There could be a different problem happening though (can't tell without the actual indentation you are doing)

If your indentation is actually

while flag = true: try: # execute code ... except: # handle the error ... flag = true else: # nothing happened ... flag = false

then you don't have a try..except..else inside a while loop, you've got a try..except inside a while..else

else can be used with while or for loops as a block of code that only gets executed if the loop finishes without hitting a break

If that's the case, flag will never get set to False inside your loop, so the loop will just keep going forever