About 52 results
Open links in new tab
  1. Catch exception and continue try block in Python

    152 No, you cannot do that. That's just the way Python has its syntax. Once you exit a try-block because of an exception, there is no way back in. What about a for-loop though?

  2. python - How can I write a `try`/`except` block that catches all ...

    Feb 14, 2011 · In Python, all exceptions must be instances of a class that derives from BaseException, but if you can omit it for a general case - omit it, problem is, linters wine about it.

  3. exception - Catch any error in Python - Stack Overflow

    Jul 25, 2011 · Is it possible to catch any error in Python? I don't care what the specific exceptions will be, because all of them will have the same fallback.

  4. How to work with try and except in python? - Stack Overflow

    May 28, 2020 · The Exception class is the superclass of every single built-in exception in the Python environment that are non-system-exiting (read here) and its generally a bad practice to …

  5. What is a good way to handle exceptions when trying to read a …

    I want to read a .csv file in python. I don't know if the file exists. My current solution is below. It feels sloppy to me because the two separate exception tests are awkwardly juxtaposed. Is th...

  6. How can use Try/Catch in Python - Stack Overflow

    Sep 21, 2018 · How can use Try/Catch in Python Asked 7 years, 4 months ago Modified 1 year, 5 months ago Viewed 10k times

  7. try catch - Correct usage of try and except (error) in python - Stack ...

    Sep 29, 2025 · Correct usage of try and except (error) in python [duplicate] Asked 4 months ago Modified 4 months ago Viewed 168 times

  8. Catch and print full Python exception traceback without …

    I want to catch and log exceptions without exiting, e.g., try: do_stuff () except Exception as err: print (Exception, err) # I want to print the entire traceback here, # not just the

  9. Using python "with" statement with try-except block

    Sep 4, 2010 · That's the benefit of the with statement, much more than saving you three lines of code in this particular instance. And yes, the way you've combined with and try-except is pretty …

  10. What is the intended use of the optional "else" clause of the "try ...

    Looking at Python reference it seems that else is executed after try when there's no exception. The optional else clause is executed if and when control flows off the end of the try clause. 2 …