Unable to launch cqlsh in datastax Cassandra distribution - cassandra

I have donwloaded ddac-5.1.17, and can successfully launch cassandra server.
But on executing 'cqlsh' command from command line in Windows 10, I get strange error:
\ddac-5.1.17\bin>cqlsh
File "....\ddac-5.1.17\bin\cqlsh.py", line 152
except ImportError, e:
SyntaxError: invalid syntax
What's wrong here?

Use python 2.7,
You can find detail here
https://issues.apache.org/jira/browse/CASSANDRA-10190
I hope this helps !

Related

switched to mac and while running python programs in my vs code get SyntaxError: invalid syntax >>> /usr/local/bin/python3

just now switched to macbook and while running python in vs code i get
/usr/local/bin/python3 "/Users/rohitraaj/Documents/python vs/2nd.py"
File "<stdin>", line 1
/usr/local/bin/python3 "/Users/rohitraaj/Documents/python vs/2nd.py"
^
SyntaxError: invalid syntax
..how to solve this anyone please?
i tried finding the solution but was not able to get anything..
expecting that if someone might have encountered the same problem than they can help or if anyone can help to fix this.

cx_Oracle.DatabaseError: DPI-1072: the Oracle Client library version is unsupported using Python 3.7

I am trying to use Python 3.7 via Intellij Ultimate 2020.1 to run simple scripts on SQL Developer 19.4.
I have downloaded and installed the cx_Oracle python library, downloaded
Oracle Instant Client Basic Package and SQL*Plus package and set them in the same folder.
Here is my code which produces the error with certain specific bits left out for security reasons:
import cx_Oracle
import pyperclip
lib_dir=r"<PATH>\instantclient_19_9"
cx_Oracle.init_oracle_client(lib_dir)
user=input("Please enter your username for the DB: ")
input("Please copy the password for <DB> Now, press enter here when complete") #Need to copy the password into clipboard so pyperclip can paste it in the password field for security
#Start the connection
connection = cx_Oracle.connect(user, pyperclip.paste(), "<HOST ADDRESS>") #Username,password,hostaddress
# Obtain a cursor
cursor = connection.cursor()
# Execute the query
sql = """<SQL QUERY>"""
cursor.execute(sql)
# Loop over the result set and save as a list
output=[]
for row in cursor:
output=output.append(row)
print(output)
#Close the connection
cursor.close()
connection.close()
When i run this I get the following error:
File "C:/Users/F694236/IdeaProjects/untitled1/.idea/5030testv0.py", line 5, in
cx_Oracle.init_oracle_client(lib_dir)
cx_Oracle.DatabaseError: DPI-1072: the Oracle Client library version is unsupported
I have scoured the installation guides but cannot see any solution to this problem that has worked
UPDATE:
After running the environment variable with DPI_DEBUG_LEVEL to 64 it gives this output:
ODPI [09396] 2020-11-27 09:52:28.968: load in parameter directory
ODPI [09396] 2020-11-27 09:52:28.968: load in dir \\<PATH>\F694236\instantclient_19_9
ODPI [09396] 2020-11-27 09:52:28.968: load with name \\<PATH>\F694236\instantclient_19_9/oci.dll
ODPI [09396] 2020-11-27 09:52:28.998: load by OS successful
ODPI [09396] 2020-11-27 09:52:28.998: validating loaded library
Traceback (most recent call last):
File "<input>", line 3, in <module>
File "C:<>\DEV\Tools\IntelliJUltimate\2020.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\<>\DEV\Tools\IntelliJUltimate\2020.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/F694236/IdeaProjects/untitled1/.idea/5030testv0.py", line 5, in <module>
cx_Oracle.init_oracle_client(lib_dir)
cx_Oracle.DatabaseError: DPI-1072: the Oracle Client library version is unsupported
Well my first questions would be: have you configured the Environment Variables?
If yes it might be that Intellij finds another version of oci.dll in your Path, until the end of the Path is reached.
My suggestion would be to check your PATH environment variable and check each directory in your PATH for any oci.dll which might be there.
Maybe the following Link will help you out as well:
https://cx-oracle.readthedocs.io/en/latest/user_guide/initialization.html#initialization
In the meantime, if the Oracle Client has been installed accordingly, you can try as workaround, the following thing:
dsn = cx_Oracle.makedsn(hostname, port_number, sid)
connection = cx_Oracle.connect(SCHEMA_NAME, SCHEMA_PASSWORD, dsn)
cursor = connection.cursor()
I know that the above workaround is not really security-friendly, but at least you can try and see if the problem is related to the Oracle Client or you need to search for the problem somewhere else.
Make sure that the Oracle Instant Client is the same 32- or 64-bitness as your Python executable. If this doesn't solve it, then before starting Python, set the environment variable DPI_DEBUG_LEVEL to 64 and update your question with what it shows - it will be the search path used to load the Oracle Client libraries.
In my case the Oracle Instant Client version I was using was too old. I was using the version of Instant Client that supported Windows 7, but I was running on Windows 10. It must not be compatible with what Python 3.7 was using. Using the latest version of Oracle Instant Client dlls with my Python 3.7 application made it work.
I only needed to add oci.dll and oraociei.dll into the same folder where I had my .py program. I used import cx_Oracle and my call to cx_Oracle.connect was successful.

Getting invalid syntax error when i try to start yugabytes DB

I have installed yugabytes DB in linux machine and when i try to start the cluster using yugabyted and getting error as invalid syntax. Please help how to resolve this issue.
./bin/yugabyted status
File "./bin/yugabyted", line 1430
with open(out_log, "a") as out_log, open(err_log, "a") as err_log:
^
SyntaxError: invalid syntax
Python version using - 2.6.6
Linux Version - 2.6.32-754.31.1.el6.x86_64
This is a Python 2.6 issue where multiple contextmanagers in the same line are not supported - https://docs.python.org/2.7/reference/compound_stmts.html#the-with-statement. While the fix for this particular error should be simple, Python 2.6 is quite outdated at this point - retired in 2013 according to https://www.python.org/downloads/release/python-269/ - and I would recommend upgrading to Python 2.7.

Can't get cqlsh to run

I've installed DSE 5.1.10 + the DSE demos as per these instructions on ubuntu.
Apparently it doesn't come with cqlsh so I went about installing it myself.
I've tried various methods the latest of which being
pip3 install cqlsh
this completed successfully and I can now run
cqlsh -version
and get
cqlsh 5.0.1
when running
cqlsh
I get the following error
Traceback (most recent call last):
File "/usr/bin/dsecqlsh.py", line 510, in <module>
cqlsh.main(*cqlsh.read_options(sys.argv[1:], os.environ))
File "/usr/bin/cqlsh.py", line 2447, in main
encoding=options.encoding)
File "/usr/bin/dsecqlsh.py", line 383, in __init__
connect_timeout=connect_timeout)
File "/usr/bin/cqlsh.py", line 528, in __init__
self.get_connection_versions()
File "/usr/bin/cqlsh.py", line 645, in get_connection_versions
if result['dse_version']:
KeyError: 'dse_version'
Any ideas what I'm doing wrong?
Thanks
I'm curious as to your source of information that says DSE does not include the cqlsh command line. As far as I am aware all versions of DSE will install this.
To me it looks like you have clobbered your cqlsh install with the pip3 install command. You've likely installed the OSS version of cqlsh, hence the error complaining about the dse_version above.
I would say at first try uninstalling the pip3 version and see if that helps and then uninstall DSE and reinstall.
Not sure what was wrong, resorted to removing everything and installing from tarball instead following https://docs.datastax.com/en/install/doc/install60/installTARdse.html

Syntax error resulting from builtin functions in Python33.exe

I'm quite new to python and I just installed python 3.3.2 in my Win 8 64bit PC.
I tried typing in several builtin functions and I get a syntax error for all of them
For example:-
>>>print len("parrot")
File "<stdin>", line 1
print len("parrot")
^
SyntaxError: invalid syntax
I uninstalled/reinstalled python several times and added the path variable automatically during installation as well as manually after installation.
I suspect this might be something related to Win 8 but I'm not sure. Does anyone else have this issue with Python33 on Win8?
Solutions to get python going would be greatly appreciated.
Thanks!
print is now a function
print(len("parrot"))
should work

Resources