Cassandra: File "cqlsh", line 95 except ImportError, e:

Eric Francis picture Eric Francis · Oct 2, 2013 · Viewed 20.3k times · Source

I am having trouble getting Cassandra up and running. I have downloaded Cassandra 2.0.1 and Python 3.3.2.

Upon starting the CLI for cassandra I get an error:

C:\Dev\ApacheCassandra\apache-cassandra-2.0.1\bin>python cqlsh
  File "cqlsh", line 95
    except ImportError, e:
                      ^
SyntaxError: invalid syntax

Any suggestions? I am going to downgrade python to 2.7 and see if that fixes my issue.

Thanks!

Answer

user2555451 picture user2555451 · Oct 2, 2013

The version of Cassandra that you are using is only compatible with Python 2.x.

The following syntax:

except ImportError, e:

was deprecated in Python 2.7 and removed in Python 3.x. Nowadays, you use the as keyword:

except ImportError as e:

This means that you need to either downgrade to Python 2.x or get a version of Cassandra that is compatible with Python 3.x.