unable to connect to Astra using python driver, Java works fine

238 views
Skip to first unread message

Li Lin

unread,
Jun 13, 2020, 4:21:13 AM6/13/20
to DataStax Python Driver for Apache Cassandra User Mailing List
I got some error when trying to connect to Astra using python driver, at the same time my Java code can connect without issue, could anyone help to point me to the right connection?

I'm using Ubuntu 20.04, and its default python 3.8

# requirement.txt

cassandra-driver==3.23.0  # via -r requirements.in
click==7.1.2              # via geomet
geomet==0.1.2             # via cassandra-driver
lz4==3.1.0                # via -r requirements.in
mimesis==4.0.0            # via -r requirements.in
six==1.15.0               # via cassandra-driver, geomet

# code
cluster = Cluster(
            cloud={'secure_connect_bundle': 'astra.zip'}, # this file works with java code
            auth_provider=PlainTextAuthProvider('user', 'pass')) # same username and password work in java code
        return cluster.connect('vino9') # this keyspace does exist. not using this parameter resulting in same error

# error message 
Traceback (most recent call last):
  File "/usr/lib/python3.8/urllib/request.py", line 1326, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1240, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1286, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1235, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1006, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 946, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1409, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL] internal error (_ssl.c:1108)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lee/Projects/git/bank-demo/testdata/venv/lib/python3.8/site-packages/cassandra/datastax/cloud/__init__.py", line 137, in read_metadata_info
    response = urlopen(url, context=config.ssl_context, timeout=timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1369, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1329, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL] internal error (_ssl.c:1108)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gen_accounts.py", line 104, in <module>
    sess = create_session('astra')
  File "gen_accounts.py", line 79, in create_session
    cluster = Cluster(
  File "cassandra/cluster.py", line 1122, in cassandra.cluster.Cluster.__init__
  File "/home/lee/Projects/git/bank-demo/testdata/venv/lib/python3.8/site-packages/cassandra/datastax/cloud/__init__.py", line 92, in get_cloud_config
    config = read_metadata_info(config, cloud_config)
  File "/home/lee/Projects/git/bank-demo/testdata/venv/lib/python3.8/site-packages/cassandra/datastax/cloud/__init__.py", line 140, in read_metadata_info
    raise DriverException("Unable to connect to the metadata service at %s. "
cassandra.DriverException: Unable to connect to the metadata service at https://f99fef32-c430-4ee2-9f46-7fca05d39513-us-east1.db.astra.datastax.com:30118/metadata. Check the cluster status in the cloud console.


Li Lin

unread,
Jun 13, 2020, 4:48:32 AM6/13/20
to DataStax Python Driver for Apache Cassandra User Mailing List
I tried the same code on a Mac, with python 3.7, worked fine....hm...

Alan Boudreault

unread,
Jun 13, 2020, 7:14:56 AM6/13/20
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi Li Lin,

This is a known issue. It will be fixed in the next 3.24 release, planned for wednesday.

Alan

--
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.


--
Alan Boudreault

Reply all
Reply to author
Forward
0 new messages