How to access cqlsh from python subprocess?

264 views
Skip to first unread message

Daniel Hong

unread,
Jan 26, 2017, 3:55:11 PM1/26/17
to DataStax Python Driver for Apache Cassandra User Mailing List
I am trying to access cqlsh from my localhost node using python subprocess because I want the script to execute the COPY command which is cqlsh specific. 

I tried running this command, but got an exit code = 1. Has anyone here ever use subprocess to connect to cqlsh? What am I missing or have wrong here?

import subprocess

host = "127.0.0.1"
user = "cassandra"
password = "cassandra"

process = subprocess.Popen("cqlsh " + host + " -u " + user + " -p " + password, shell=True)
exitCode = process.wait()

Adam Holmberg

unread,
Jan 27, 2017, 12:38:07 PM1/27/17
to python-dr...@lists.datastax.com
This is not really a driver question, but you might learn something if you capture stdout and stderr to see why the cqlsh invocation is failing.

Does that exact command work in the current directory where this script is being run?

Adam



--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages