About 10,200,000 results
Open links in new tab
  1. Manually raising (throwing) an exception in Python

    How do I raise an exception in Python so that it can later be caught via an except block?

  2. How to use "raise" keyword in Python - Stack Overflow

    63 raise without any arguments is a special use of python syntax. It means get the exception and re-raise it. If this usage it could have been called reraise.

  3. Python "raise from" usage - Stack Overflow

    What's the difference between raise and raise from in Python?

  4. How do I declare custom exceptions in modern Python?

    By "modern Python" I mean something that will run in Python 2.5 but be 'correct' for the Python 2.6 and Python 3.* way of doing things. And by "custom" I mean an Exception object that can …

  5. python - How to re-raise an exception in nested try/except blocks ...

    Aug 12, 2013 · 205 I know that if I want to re-raise an exception, I simple use raise without arguments in the respective except block. But given a nested expression like

  6. python - raise statement on a conditional expression - Stack …

    Oct 8, 2022 · 29 Inline/ternary if is an expression, not a statement. Your attempt means "if bool, return value, else return the result of raise expression " - which is nonsense of course, …

  7. How do I raise the same Exception with a custom message in …

    Feb 6, 2012 · This fails to answer the actual question. Yes, we all know how to chain Python 3.x exceptions in 2020. The actual question is how to modify the original exception message of …

  8. python - Difference between "raise" and "raise e"? - Stack Overflow

    Mar 22, 2016 · In python, is there a difference between raise and raise e in an except block? dis is showing me different results, but I don't know what it means. What's the end behavior of both? …

  9. python - How to raise a ValueError? - Stack Overflow

    Dec 9, 2010 · By-the-way, I think find_last(), find_last_index(), or something simlar would be a more descriptive name for this function. Adding to the possible confusion is the fact that …

  10. python - Timeout on a function call - Stack Overflow

    Jan 30, 2009 · I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds …