You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "guluo2016 (via GitHub)" <gi...@apache.org> on 2026/02/02 14:40:40 UTC
Re: [PR] HBASE-29454 Update hbase-examples scripts to be compatible with Python 3 [hbase]
guluo2016 commented on code in PR #7687:
URL: https://github.com/apache/hbase/pull/7687#discussion_r2754676289
##########
hbase-examples/src/main/python/thrift1/DemoClient.py:
##########
@@ -131,25 +123,25 @@ def demo_client(host, port, is_framed_transport):
try:
mutations = [Mutation(column="entry:foo", value=invalid)]
client.mutateRow(t, invalid, mutations, dummy_attributes)
- except ttypes.IOError, e:
- print 'expected exception: %s' %(e.message)
+ except ttypes.IOError as e:
+ print(f'expected exception: {e.message}')
# Run a scanner on the rows we just created
- print "Starting scanner..."
+ print("Starting scanner...")
scanner = client.scannerOpen(t, "", ["entry:"], dummy_attributes)
r = client.scannerGet(scanner)
while r:
printRow(r[0])
r = client.scannerGet(scanner)
- print "Scanner finished"
+ print("Scanner finished")
#
# Run some operations on a bunch of rows.
#
for e in range(100, 0, -1):
# format row keys as "00000" to "00100"
- row = "%0.5d" % (e)
+ row = f"{row:05}"
Review Comment:
Should use `e` instead of `row`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org