Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15182

cqlsh syntax error output fails with UnicodeEncodeError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • CQL/Interpreter
    • None
    • Correctness - API / Semantic Implementation
    • Low
    • Low Hanging Fruit
    • User Report
    • All
    • None

    Description

      I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9.

      when I run this cql command: bin/cqlsh hadoop4 -u dba -p ********** --debug  -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) VALUES ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 ,796.0,2205,746,'null','null','null',0,'379');"

      I get the error message as below:

      Using CQL driver: <module 'cassandra' from '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/_init_.py'>
      Using connect timeout: 5 seconds
      Using 'utf-8' encoding
      Using ssl: False
      Traceback (most recent call last):
      File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd
      self.handle_statement(st, statementtext)
      File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement
      return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr))
      File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1000, in perform_statement
      success, future = self.perform_simple_statement(stmt)
      File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1053, in perform_simple_statement
      self.printerr(unicode(err._class.name_) + u": " + err.message.decode(encoding='utf-8'))
      File "/usr/local/python27/lib/python2.7/encodings/utf_8.py", line 16, in decode
      return codecs.utf_8_decode(input, errors, True)
      UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in position 60: ordinal not in range(128)

       

      this issue seems different with the select command issue on  https://issues.apache.org/jira/browse/CASSANDRA-10875 

      and other method to add " coding: utf-8 " in the head of cqlsh.py ,  can anyone hurry up to teach me?

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            gloCalHelp.com gloCalHelp.com
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: