sylD avatar image
sylD asked Erick Ramirez commented

Failed to connect to Astra with Python driver, "got an unexpected keyword argument 'cloud'"

Following the default how to once the Database created ( I'm facing the issue

Traceback (most recent call last):                                                                                                                
  File "", line 19, in <module>                                                                                                          
    cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)                                                                            
  File "cassandra/", line 843, in cassandra.cluster.Cluster.__init__                                                                    
TypeError: __init__() got an unexpected keyword argument 'cloud'       
The begining of the python script is this one :
  1 from confluent_kafka import Consumer, KafkaError
  2 from cassandra.cluster import Cluster
  3 from cassandra.auth import PlainTextAuthProvider
  5 import boto3
  6 import exifread
  7 import json
  8 import os
 10 def dms2dd(degrees, minutes, seconds):
 11      dd = float(degrees) + float(minutes)/60 + float(seconds)/3600
 12      return dd
 15 cloud_config= {
 16         'secure_connect_bundle': './'
 17 }
 18 auth_provider = PlainTextAuthProvider('databaseusername', 'databasepassword')
 19 cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)
 20 session = cluster.connect()

If you get idea I will appreciate,

Thanks & Regards,

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

I suspect that the problem is that you haven't provided the full path to your secure bundle.

If your secure bundle is in /home/syid/astra, your configuration should have:

cloud_config= {
        'secure_connect_bundle': '/home/syid/astra/'

Try that and let me know how you go. Cheers!

[UPDATE] My other suspicion is that you're using an old version of the Python driver.

Support for Astra was added in version 3.20.0. Please check the version you're running. I suggest you upgrade to the latest.

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

sylD avatar image sylD commented ·

Hello Erick !

Thanks for your answers,
You right, the issue was coming from the driver which was too old,

Have a nice day,

Kind Regards,

2 Likes 2 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ sylD commented ·

Glad to hear and thanks for confirming the resolution. Cheers!

0 Likes 0 ·