When importing datastax cassandra-driver(python) get the following error
Error
File "cassandra.py", line 1, in <module>
from cassandra.cluster import Cluster
File "/home/vagrant/cassandra.py", line 1, in <module>
from cassandra.cluster import Cluster
ImportError: No module named cluster
This is the code
from cassandra.cluster import Cluster
print dir(cassandra.cluster)
cluster = Cluster()
session = cluster.connect('userspace')
rows = session.execute('SELECT user_name, gender FROM users')
for user_row in rows:
print user_row.user_name, user_row.gender
Well, it looks like names conflict. Your script is cassandra.py
and so it is the module for the driver. Try to rename your script (and don't forget to delete its .pyc
) and try again
Install CQL interactive terminal:
sudo pip install cqlsh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With