-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Invalid syntax in "/spacy/lang/ko/__init__.py" when calling spacy.blank("ko") for Korean #4068
Comments
Thanks for the report – looks like the problem here are the type annotations on the named tuple. There is a condition for Python 2.7 and 3.5, but I guess 2.7 just sees this as a syntax error and fails regardless 😞 Are you able to upgrade to Python 3? If so, that'd be the easiest workaround for now. Relevant source is here btw: https:/explosion/spaCy/blob/master/spacy/lang/ko/__init__.py It might make sense to rewrite the code so it doesn't use a named tuple, if possible. That means we could remove all the Python version handling and compatibility hacks here. (We will drop 2.7 and 3.5 eventually, but for now, we do have to support both.) |
A lot of my team's code is dependent on Python 2.7 actually, because converting to Python 3 would actually generate pretty much the same kind of errors we're seeing here haha. |
@veer-bains Yeah, I totally understand that! The other alternative would be to build spaCy from source and remove the non-2.7 code in that file. (Or maybe someone on your team even has some time to fix it and submit a PR 🙂 This way, we can definitely make sure to ship the fix in the next release.) |
@ines Will do my best! |
…loses explosion#4068) * fixed syntax error in declaring variables with python 2.7 in spacy/lang/ko/__init__.py * fixed syntax error in declaring variables with python 2.7 in spacy/lang/ko/__init__.py * Update __init__.py * Create veer-bains.md * Update __init__.py fixed syntax errors in variable datatype assignment when calling spacy.blank("ko") with python 2.7
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
How to reproduce the behaviour
calling
spacy.blank("ko")
produces the following traceback:
`File "/usr/lib64/python2.7/site-packages/spacy/init.py", line 31, in blank
LangClass = util.get_lang_class(name)
File "/usr/lib64/python2.7/site-packages/spacy/util.py", line 70, in get_lang_class
module = importlib.import_module(".lang.%s" % lang, "spacy")
File "/usr/lib64/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/usr/lib64/python2.7/site-packages/spacy/lang/ko/init.py", line 28
SyntaxError: invalid syntax`
The same script has worked fine for me with other languages, and the same format of data(english, german, chinese, spanish, and a few others), so perhaps this may not be an error on my side.
Your Environment
The text was updated successfully, but these errors were encountered: