Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with recent versions of JPype #46

Open
nishkalavallabhi opened this issue Jul 23, 2020 · 1 comment
Open

Incompatibility with recent versions of JPype #46

nishkalavallabhi opened this issue Jul 23, 2020 · 1 comment

Comments

@nishkalavallabhi
Copy link

I tried running duckling after installing a more recent version of JPype and started getting the following error when I tried using the parse_time function:

/usr/local/lib/python3.6/dist-packages/jpype/_jstring.py in getitem(self, i)
46
47 def getitem(self, i):
---> 48 if i < 0:
49 i += len(self)
50 if i < 0:

TypeError: '<' not supported between instances of 'slice' and 'int'

When I revert back to JPype 0.7.4 (the one I used before), it works, but I get a deprecation warning:

""/usr/local/lib/python3.6/dist-packages/jpype/_core.py:209: UserWarning:
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False. The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
""")"

It says I have to file a ticket with the developer if I notice this warning. Since current pip install for duckling installs JPype 1.0 and not older versions, it will throw the same error for many others. can you please take a look at this?

@Thrameos
Copy link

Thrameos commented Aug 4, 2020

The problem here is the developer is depending on Java strings automatically converting to Python strings which was deprecated behavior (with a warning issued for the last year). If that was desired behavior then convertStrings=True should be passed to startJVM. However, it would be better to just apply the required fix instead. At the line where the parse_time is raising just add "str()" prior to calling the slice operator.

I will place an issue on JPype that we should consider supporting slicing of strings on __getitem__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants