You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Yinyin L (JIRA)" <ji...@apache.org> on 2013/12/01 04:14:35 UTC

[jira] [Comment Edited] (CASSANDRA-6425) cqlsh cannot found cql driver when invoked through link

    [ https://issues.apache.org/jira/browse/CASSANDRA-6425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13835934#comment-13835934 ] 

Yinyin L edited comment on CASSANDRA-6425 at 12/1/13 3:13 AM:
--------------------------------------------------------------

# Here is the patch I used to resolve this problem

diff --git a/bin/cqlsh b/bin/cqlsh
index acfb1f6..2c43a6f 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -66,9 +66,12 @@ except ImportError:
 CQL_LIB_PREFIX = 'cql-internal-only-'
 THRIFT_LIB_PREFIX = 'thrift-python-internal-only-'
 
+CASSANDRA_INSTALL_BASE = os.path.join(
+        os.path.dirname(os.path.realpath(__file__)), '..')
+
 # use bundled libs for python-cql and thrift, if available. if there
 # is a ../lib dir, use bundled libs there preferentially.
-ZIPLIB_DIRS = [os.path.join(os.path.dirname(__file__), '..', 'lib')]
+ZIPLIB_DIRS = [os.path.join(CASSANDRA_INSTALL_BASE, 'lib')]
 myplatform = platform.system()
 if myplatform == 'Linux':
     ZIPLIB_DIRS.append('/usr/share/cassandra/lib')
@@ -106,7 +109,7 @@ from cql.cqltypes import (cql_types, cql_typename, lookup_casstype, lookup_cqlty
 
 # cqlsh should run correctly when run out of a Cassandra source tree,
 # out of an unpacked Cassandra tarball, and after a proper package install.
-cqlshlibdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'pylib')
+cqlshlibdir = os.path.join(CASSANDRA_INSTALL_BASE, 'pylib')
 if os.path.isdir(cqlshlibdir):
     sys.path.insert(0, cqlshlibdir)
 



was (Author: yinyin):
diff --git a/bin/cqlsh b/bin/cqlsh
index acfb1f6..2c43a6f 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -66,9 +66,12 @@ except ImportError:
 CQL_LIB_PREFIX = 'cql-internal-only-'
 THRIFT_LIB_PREFIX = 'thrift-python-internal-only-'
 
+CASSANDRA_INSTALL_BASE = os.path.join(
+        os.path.dirname(os.path.realpath(__file__)), '..')
+
 # use bundled libs for python-cql and thrift, if available. if there
 # is a ../lib dir, use bundled libs there preferentially.
-ZIPLIB_DIRS = [os.path.join(os.path.dirname(__file__), '..', 'lib')]
+ZIPLIB_DIRS = [os.path.join(CASSANDRA_INSTALL_BASE, 'lib')]
 myplatform = platform.system()
 if myplatform == 'Linux':
     ZIPLIB_DIRS.append('/usr/share/cassandra/lib')
@@ -106,7 +109,7 @@ from cql.cqltypes import (cql_types, cql_typename, lookup_casstype, lookup_cqlty
 
 # cqlsh should run correctly when run out of a Cassandra source tree,
 # out of an unpacked Cassandra tarball, and after a proper package install.
-cqlshlibdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'pylib')
+cqlshlibdir = os.path.join(CASSANDRA_INSTALL_BASE, 'pylib')
 if os.path.isdir(cqlshlibdir):
     sys.path.insert(0, cqlshlibdir)
 


> cqlsh cannot found cql driver when invoked through link
> -------------------------------------------------------
>
>                 Key: CASSANDRA-6425
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6425
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>         Environment: Linux (ubuntu 12.04)
>            Reporter: Yinyin L
>             Fix For: 2.0.3
>
>
> I have Cassandra installed in /opt/apache-cassandra-2.0.3 and have bin/cqlsh linked to ~/bin for easy access. However the following error message shows up on invoking through the linked (ie: ~/bin/cqlsh):
> $ cqlsh 
> Python CQL driver not installed, or not on PYTHONPATH.
> You might try "easy_install cql".
> Python: /usr/bin/python
> Module load path: ['/opt/apache-cassandra-2.0.3/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
> Error: No module named cql



--
This message was sent by Atlassian JIRA
(v6.1#6144)