Updated 4. Tips & Tricks for working with Jython (markdown)
@@ -26,6 +26,13 @@ If you want to catch all exceptions (e.g. for debugging), **do not `except Excep
|
|||||||
Since we're using jython, this will not catch Java exceptions.
|
Since we're using jython, this will not catch Java exceptions.
|
||||||
Instead, use `except` and print the traceback. This will give you some more deatails:
|
Instead, use `except` and print the traceback. This will give you some more deatails:
|
||||||
```python
|
```python
|
||||||
|
# bad
|
||||||
|
try:
|
||||||
|
#code
|
||||||
|
except Exception, e: # will not catch Java Exceptions
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
# good
|
||||||
from traceback import format_exc as trace
|
from traceback import format_exc as trace
|
||||||
try:
|
try:
|
||||||
#code
|
#code
|
||||||
Reference in New Issue
Block a user