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

ANTLR download fails due to SSLError #94

Closed
emileferreira opened this issue Apr 16, 2023 · 2 comments
Closed

ANTLR download fails due to SSLError #94

emileferreira opened this issue Apr 16, 2023 · 2 comments

Comments

@emileferreira
Copy link

When executing grammarinator-process without the --antlr argument, grammarinator requests antlerinator to download the ANTLR jarfile to ~/.antlerinator/antlr-4.7.1-complete.jar. This fails on my machine with an SSLError and the following stacktrace.

Traceback (most recent call last):
  File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3.10/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.10/ssl.py", line 1062, in _create
    self._sslobj = self._context._wrap_socket(
ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<redacted>/.venv/bin/grammarinator-process", line 33, in <module>
    sys.exit(load_entry_point('grammarinator==19.3', 'console_scripts', 'grammarinator-process')())
  File "<redacted>/.venv/lib/python3.10/site-packages/grammarinator/process.py", line 708, in execute
    antlerinator.install(lazy=True)
  File "<redacted>/.venv/lib/python3.10/site-packages/antlerinator/install.py", line 47, in install
    with contextlib.closing(urlopen(tool_url, context=ssl_context)) as response:
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801)>

I am able to circumvent this issue by downloading the required ANTLR jarfile and pointing to it using the --antlr argument.

Have the SSL certificates perhaps expired?
Is grammarinator not compatible with my version of Python?

@renatahodovan
Copy link
Owner

I guess that you are using the latest release which is quite old unfortunately... :( I'm working on a new release, but until it's available, you should try to install Grammarinator from source: checkout this repo, (create a virtualenv) and run pip install . from its root.

@emileferreira
Copy link
Author

I am indeed using the latest release from PyPI. Thanks for the hint, and for your work in maintaining the project. You might want to add a note about this in the README until you've published the new release :)

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