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

Xiao Liu commented on HBASE-29457:
----------------------------------

Hi, [~kgeiszler], I have modified DemoClient.py and aligned it with the logic 
on the Java side. Could you help to try again and review the code based on the 
content of the new PR.

> thrift1/DemoClient.py is not running
> ------------------------------------
>
>                 Key: HBASE-29457
>                 URL: https://issues.apache.org/jira/browse/HBASE-29457
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Kevin Geiszler
>            Assignee: Kevin Geiszler
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: democlient-output.txt, thrift-output.txt
>
>
> HBASE-29454 converts the following scripts from Python 2 to Python 3 and 
> fixes some import errors:
> {code:java}
> hbase-examples/src/main/python/thrift1/DemoClient.py
> hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
> hbase-examples/src/main/python/thrift2/DemoClient.py
> {code}
> After these changes, the thrift1/DemoClient.py script gets the following 
> error when trying to run it:
> {code:java}
> % bin/start-hbase.sh
> % bin/hbase thrift start
> # Separate Terminal window
> % python3 hbase-examples/src/main/python/thrift1/DemoClient.py localhost 9090
> scanning tables...
>   found: b'kg_table'
>   found: b'kg_table2'
>   found: b'kg_table3'
>   found: b't1'
>   found: b'test'
> creating table: demo_table
> Traceback (most recent call last):
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/DemoClient.py",
>  line 212, in <module>
>     demo_client(host, port, is_framed_transport)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/DemoClient.py",
>  line 92, in demo_client
>     client.createTable(t, columns)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 988, in createTable
>     self.send_createTable(tableName, columnFamilies)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 996, in send_createTable
>     args.write(self._oprot)
>   File 
> "/Users/kgeiszler/projects/hbase/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py",
>  line 4973, in write
>     oprot.writeBinary(self.tableName)
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/protocol/TBinaryProtocol.py",
>  line 132, in writeBinary
>     self.trans.write(str)
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/transport/TTransport.py",
>  line 174, in write
>     raise e
>   File 
> "/Users/kgeiszler/projects/hbase/py-env/lib/python3.11/site-packages/thrift/transport/TTransport.py",
>  line 170, in write
>     self.__wbuf.write(buf)
> TypeError: a bytes-like object is required, not 'str'{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to