Closed staplet3 closed 5 years ago
Thank you! I have added your comment on the Wiki page.
I think the proper usage would be
if not jpype.isThreadAttachedToJVM():
jpype.attachThreadToJVM()
as isThreadAttachedToJVM()
returns boolean
https://jpype.readthedocs.io/en/devel/api.html#jpype.isThreadAttachedToJVM
https://github.com/jpype-project/jpype/blob/master/jpype/_core.py#L211
Otherwise as the following shows,
jpype.isThreadAttachedToJVM() is not 1
will always return True irrespective of whether the function returns True or False.
>>> False is not 1
True
>>> True is not 1
True
>>> False is not 0
True
>>> True is not 0
True
Thank you! I have updated the wiki.
Hey guys, I wrapped NegBio in a flask app and had JPype fail within the Stanford Dependencies python library. I had to modify the JPypeBackend.py file to attach the thread to the JVM. I know you don't maintain this source code, but just a heads up. Changes start on line 45:
JPypeBackend.py.zip Attached the modified file here