I'm getting this error:
ImportError: cannot import name 'SUTime' from partially initialized module 'sutime' (most likely due to a circular import)
when importing the sutime module as:
from sutime import SUTime
as suggested in the sutime GitHub example: https://github.com/FraBle/python-sutime
Context: sutime is a Python library for parsing date/time from a natural language input, developed by the amazing team over at Stanford CoreNLP.
Note: I've already run the pre-req installs as well:
>> pip install setuptools_scm jpype1 # install pre-reqs
>> pip install sutime
>> # use package pom.xml to install all Java dependencies via Maven into ./jars
>> mvn dependency:copy-dependencies -DoutputDirectory=./jars
解决方案
It's not true that a circular import is the most likely cause of your error. A failed, incomplete, or in some way strange installation is more likely. Try this:
pip uninstall sutime
pip uninstall jpype1
pip uninstall setuptools_scm
pip3 install setuptools_scm jpype1 # note: pip3
pip3 install sutime
Then, in the python-sutime directory, enter this command:
./test.sh
It should output lots of log lines, and the last line but one should be similar to this:
======================== 5 passed, 2 warnings in 13.06s ========================
In the same directory you can enter and run the Python script from the Example section of the README. It should output many log lines before the reported output. There may be a way to avoid that, but anyway it happens only once, when the script starts.