Open CarlosAlbertoN opened 4 years ago
In the source code for your sutime i.e. sutime.py, you have to change the versions of the jar files used. So you have to take care of these two files:
In your source sutime.py, make sure the jar versions listed here are the same as the jar versions you have downloaded.
If it isn't, the best thing you can do is copy the sutime.py file from this repo and replace your source sutime.py file with it.
And also make sure that in your jars folder you have this version:
Thank you for the feedback!
So, i have made the changes that you said but it's not running.
Aaah yes in your source sutime.py the last few lines of code are this:
return json.loads(self._sutime.annotate(input_str, reference_date))
return json.loads(self._sutime.annotate(input_str))
Change it to:
return json.loads(str(self._sutime.annotate(input_str, reference_date)))
return json.loads(str(self._sutime.annotate(input_str)))
The Java wrapper basically returns a java.lang.String. We have to convert that to a python str.
Also it might be better to keep this issue open till the developers fix it, so that anyone else having the same issue will be able to apply this fix.
@Utkichaps thank you! Now it's running. I'll keep the issue open.
I am getting the same error. However I feel there might be some error with my steps so I'll mention them
I have Python, Java, Maven installed and ready
I have created a new .py file. It is currently on my desktop where I have copied the following code: import os import json from sutime import SUTime if name == 'main': test_case = u'I need a desk for tomorrow from 2pm to 3pm'
jar_files = os.path.join(os.path.dirname(D:\python-sutime-master\sutime\jars'), 'jars') sutime = SUTime(jars=jar_files, mark_time_ranges=True)
print(json.dumps(sutime.parse(test_case), sort_keys=True, indent=4))
However I am still getting the error mentioned above of not all necessary Java dependencies have been downloaded
Please let me know if someone can help
Hello, @Feyorn so i had a lot of problems trying to run as well and at the end i have a code running (finally).
I have made a google colab with all the steps to make it run.
Here it is: https://colab.research.google.com/drive/1p0Y-9pnM60zHbURUyO7hJOJ72IKY5nKx?usp=sharing
Let me know if you have any questions.
Hey @CarlosAlbertoN , thank you for responding. I am still getting the same error, I am however listing the steps I followed in my Windows system:
Removed the pip intsalled sutime
From the git repo, copied the pom.xml to the folder called sutime within python-sutime.
Copied the new sutime folder containing jars, pom.xml, test, init and sutime.py to the collection of my python libraries
Using command prompt at the location of the new sutime file, I ran mvn dependency:copy-dependencies -DoutputDirectory=./jars -P english which was over 1GB of download.
Once done, I ran the code where I replaced the file with the path of the sutime packaged file.
However the error still persists. Thank you for your file, it was properly detailed. However if you can let me know if you find what error exists in my approach, that would be great. Thank you
Try to open a new terminal and execute again the code:
import os
import json
from sutime import SUTime
if name == 'main':
test_case = u'I need a desk for tomorrow from 2pm to 3pm'
jar_files = os.path.join(os.path.dirname(D:\python-sutime-master\sutime\jars'), 'jars')
sutime = SUTime(jars=jar_files, mark_time_ranges=True)
print(json.dumps(sutime.parse(test_case), sort_keys=True, indent=4))
@CarlosAlbertoN yeah, I tried that but the error didn't change
I see. I didn't try to run in windows, so maybe i'm missing a step that i didn't face. So, take a better look, maybe do the steps again. Or you can try to use with google colab instead.
Hey everyone, I'm sorry that you folks run into these issues. I've never expected that my little project gets so much traction after publishing it on GitHub.
My life kept me very busy, but I have vacation planned for later this month and plan to spend some time addressing this issue as well as the other ones filed against this project.
Hello, @Feyorn so i had a lot of problems trying to run as well and at the end i have a code running (finally).
I have made a google colab with all the steps to make it run.
Here it is: https://colab.research.google.com/drive/1p0Y-9pnM60zHbURUyO7hJOJ72IKY5nKx?usp=sharing
Let me know if you have any questions.
@CarlosAlbertoN @FraBle @Utkichaps I downloaded and ran your notebook on my colab but it's throwing the same error as: RuntimeError: Not all necessary Java dependencies have been downloaded!
Can you check what's going wrong?
Also, do we need to update the sutime.py and use str as described in the above comments?
Hello!
So, i'm trying to run python-sutime but i keep getting this error:
"RuntimeError: Not all necessary Java dependencies have been downloaded!"
The picture below are from my files after i had installed with maven:
Im using: