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

HTTP Error using languagetool #25

Open
AbdealiLoKo opened this issue Mar 11, 2016 · 6 comments
Open

HTTP Error using languagetool #25

AbdealiLoKo opened this issue Mar 11, 2016 · 6 comments

Comments

@AbdealiLoKo
Copy link

When one of our users (at coala) was running the tests, he got the following error:

E          
E           Traceback information is provided below:
E          
E           Traceback (most recent call last):
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 522, in get_languages
E               languages = cache['languages']
E           KeyError: 'languages'
E          
E           During handling of the above exception, another exception occurred:
E          
E           Traceback (most recent call last):
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 304, in _get_root
E               with urlopen(url, data, cls._TIMEOUT) as f:
E             File "/usr/lib/python3.4/urllib/request.py", line 161, in urlopen
E               return opener.open(url, data, timeout)
E             File "/usr/lib/python3.4/urllib/request.py", line 469, in open
E               response = meth(req, response)
E             File "/usr/lib/python3.4/urllib/request.py", line 579, in http_response
E               'http', request, response, code, msg, hdrs)
E             File "/usr/lib/python3.4/urllib/request.py", line 507, in error
E               return self._call_chain(*args)
E             File "/usr/lib/python3.4/urllib/request.py", line 441, in _call_chain
E               result = func(*args)
E             File "/usr/lib/python3.4/urllib/request.py", line 587, in http_error_default
E               raise HTTPError(req.full_url, code, msg, hdrs, fp)
E           urllib.error.HTTPError: HTTP Error 403: Forbidden
E          
E           During handling of the above exception, another exception occurred:
E          
E           Traceback (most recent call last):
E             File "/usr/local/lib/python3.4/dist-packages/coala-0.4.2.dev20160309195000-py3.4.egg/coalib/bears/Bear.py", line 97, in execute
E               return list(self.run_bear_from_section(args, kwargs) or [])
E             File "/home/vivek/gsoc16/coala-bears/bears/natural_language/LanguageToolBear.py", line 41, in run
E               tool = LanguageTool(locale, motherTongue="en_US")
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 195, in __init__
E               self._language = LanguageTag(language)
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 446, in __new__
E               return str.__new__(cls, cls._normalize(tag))
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 467, in _normalize
E               for language in get_languages()}
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 524, in get_languages
E               languages = LanguageTool._get_languages()
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 285, in _get_languages
E               for e in cls._get_root(url, num_tries=1):
E             File "/usr/local/lib/python3.4/dist-packages/language_check-0.8-py3.4.egg/language_check/__init__.py", line 310, in _get_root
E               raise Error('{}: {}'.format(cls._url, e))
E           language_check.Error: http://127.0.0.1:8081: HTTP Error 403: Forbidden

I went through your code and found that you were actually trying multiple ports (https://github.com/myint/language-check/blob/master/language_check/__init__.py#L177) so this couldn't be an issue that he had something else running on that port.

Could you help us in figuring out why this could happen ?
And what we could do to prevent it ?

PS: Ignore the E at the front. It is from the pytest utility when running tests

@sergeyf
Copy link

sergeyf commented Sep 1, 2017

I had the same issue. Just install the latest from git instead of pip and it works fine.

@aashish-amber-abz
Copy link

i installed using git still facing the same error , kindly help

@sshojiro
Copy link

The issue discussed here comes to me and I also cannot solve it. Does anyone know the solution aside from the re-install?

@jxmorris12
Copy link

Hi! Since this project has been abandoned, I started a new fork over at https://github.com/jxmorris12/language_tool_python.

My version supports new versions of Java and LanguageTool. language-check is stuck on Java 8 and LanguageTool 3.2; latest versions are Java 14 and LanguageTool 4.9!

I'm happy to help you with your issue if you raise it over at my repository! Thanks!

@sherpa-lakpa
Copy link

Hi! I fixed similiar issue following below steps:

  1. Setup openjdk-8-jdk
  • sudo apt install openjdk-8-jdk
  • sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
  1. Manually download file from https://languagetool.org/download/LanguageTool-3.2.zip
  2. export LANGUAGE_CHECK_DOWNLOAD_HOST="file:///home/lakpa/Downloads/LanguageTool-3.2.zip"
  3. pip install git+https://github.com/myint/language-check

Hope this helps.

Regards

@zzk0
Copy link

zzk0 commented Dec 18, 2022

Hi! Since this project has been abandoned, I started a new fork over at https://github.com/jxmorris12/language_tool_python.

My version supports new versions of Java and LanguageTool. language-check is stuck on Java 8 and LanguageTool 3.2; latest versions are Java 14 and LanguageTool 4.9!

I'm happy to help you with your issue if you raise it over at my repository! Thanks!

It works! Thanks for your help.

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

No branches or pull requests

8 participants