You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i want get JException,then run this code in python3.5 and jpype0.6.3 :
try :
# Code that throws a java.lang.RuntimeException
except (jpype.JException(java.lang.RuntimeException),e):
print ("Caught the runtime exception : ", JavaException.message())
print (JavaException.stackTrace())
It throw a message :
Traceback (most recent call last):
File "demo.py", line 67, in getTable_Query
json_str = test.Query(self.ui.spinBox.value())
File "D:\java_py35\connect.py", line 142, in Query
except (jpype.JException(java.lang.RuntimeException),e):
TypeError: catching classes that do not inherit from BaseException is not allowed
if change the code like this
try :
# Code that throws a java.lang.RuntimeException
except (jpype.JException(e)):
print ("Caught the runtime exception : ", e)
it only print: Caught the runtime exception : com.alipay.api.AlipayApiException
the error message is not whole message.
could anyone tell me why?
The text was updated successfully, but these errors were encountered:
junechen22
changed the title
jpype.JException cannot run in python 3.5
jpype.JException cannot print whole message in python 3.5
Jun 8, 2018
There is something about JPype exceptions where they don't throw the java type but rather a class contained within it. I haven't yet puzzled out why it is constructed like that, and I have a patch to correct it but as it causes API breakage I haven't submitted it yet. I believe the issue you are having is that you are expecting the exception type to be the java exception but you get a wrapper class. You have to unwrap the wrapper class to get to the full message IIRC.
when i want get JException,then run this code in python3.5 and jpype0.6.3 :
It throw a message :
if change the code like this
it only print:
Caught the runtime exception : com.alipay.api.AlipayApiException
the error message is not whole message.
could anyone tell me why?
The text was updated successfully, but these errors were encountered: