This is an automated email from the ASF dual-hosted git repository.
lupeng pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new 5b12ad6edb8 HBASE-29454: Update hbase-examples scripts to be
compatible with Python 3 (#7161) (#7671)
5b12ad6edb8 is described below
commit 5b12ad6edb8aecb9cbe30baa9515712946a814ef
Author: Liu Xiao <[email protected]>
AuthorDate: Fri Feb 6 19:09:04 2026 +0800
HBASE-29454: Update hbase-examples scripts to be compatible with Python 3
(#7161) (#7671)
Signed-off-by: Peng Lu <[email protected]>
Co-authored-by: Kevin Geiszler <[email protected]>
---
.gitignore | 1 +
dev-support/blanks-eol-ignore.txt | 2 +-
dev-support/blanks-tabs-ignore.txt | 2 +-
hbase-examples/README.txt | 10 ++-
.../src/main/python/thrift1/DemoClient.py | 74 ++++++++++------------
.../thrift1/demo_hbase_thrift_over_http_tls.py | 49 +++++++-------
.../main/python/thrift1/gen-py/hbase/__init__.py | 1 -
.../thrift1/{gen-py => gen_py}/hbase/Hbase-remote | 0
.../thrift1/{gen-py => gen_py}/hbase/Hbase.py | 0
.../main/python/thrift1/gen_py/hbase/__init__.py | 18 ++++++
.../thrift1/{gen-py => gen_py}/hbase/constants.py | 0
.../thrift1/{gen-py => gen_py}/hbase/ttypes.py | 0
.../src/main/python/thrift2/DemoClient.py | 37 +++++------
.../main/python/thrift2/gen-py/hbase/__init__.py | 1 -
.../{gen-py => gen_py}/hbase/THBaseService-remote | 0
.../{gen-py => gen_py}/hbase/THBaseService.py | 0
.../main/python/thrift2/gen_py/hbase/__init__.py | 18 ++++++
.../thrift2/{gen-py => gen_py}/hbase/constants.py | 0
.../thrift2/{gen-py => gen_py}/hbase/ttypes.py | 0
hbase-server/src/main/python/hbase/merge_conf.py | 2 +-
20 files changed, 122 insertions(+), 93 deletions(-)
diff --git a/.gitignore b/.gitignore
index 817d9fd6ee6..6d1584c8890 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ linklint/
tmp
**/.flattened-pom.xml
.vscode/
+**/__pycache__
diff --git a/dev-support/blanks-eol-ignore.txt
b/dev-support/blanks-eol-ignore.txt
index 6912be30837..51edc75be9d 100644
--- a/dev-support/blanks-eol-ignore.txt
+++ b/dev-support/blanks-eol-ignore.txt
@@ -20,5 +20,5 @@
.*/gen-cpp/.*
.*/gen-perl/.*
.*/gen-php/.*
-.*/gen-py/.*
+.*/gen_py/.*
.*/gen-rb/.*
diff --git a/dev-support/blanks-tabs-ignore.txt
b/dev-support/blanks-tabs-ignore.txt
index 49185487846..54f35708c4d 100644
--- a/dev-support/blanks-tabs-ignore.txt
+++ b/dev-support/blanks-tabs-ignore.txt
@@ -20,7 +20,7 @@
.*/gen-cpp/.*
.*/gen-perl/.*
.*/gen-php/.*
-.*/gen-py/.*
+.*/gen_py/.*
.*/gen-rb/.*
# we have tabs in asciidoc, not sure whether it is OK to replace them with
spaces
src/main/asciidoc/.*
diff --git a/hbase-examples/README.txt b/hbase-examples/README.txt
index 894586615c0..5425af09233 100644
--- a/hbase-examples/README.txt
+++ b/hbase-examples/README.txt
@@ -17,6 +17,12 @@ Example code.
${HBASE_ROOT}/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
and re-placed at the corresponding paths. You should not have to do this
generally.
+ For Python, modules with a dash cannot be imported. Instead, you must use
an underscore or no
+ dash at all. You can generate the code in a custom directory with the
following:
+ mkdir gen_py
+ thrift --gen py --out gen_py \
+
${HBASE_ROOT}/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
+
Before you run any Thrift examples, find a running HBase Thrift server
(and a running
hbase cluster for this server to talk to -- at a minimum start a
standalone instance
by doing ./bin/start-hbase.sh). If you start one locally (bin/hbase thrift
start),
@@ -38,8 +44,8 @@ Example code.
1. Modify the import path in the file to point to
{$THRIFT_HOME}/lib/rb/lib.
2. Execute {ruby DemoClient.rb} (or {ruby DemoClient.rb <host> <port>}).
- * Python: hbase-examples/src/main/python/DemoClient.py
- 1. Modify the added system path in the file to point to
{$THRIFT_HOME}/lib/py/build/lib.[YOUR SYSTEM]
+ * Python: hbase-examples/src/main/python/thrift1/DemoClient.py and
hbase-examples/src/main/python/thrift2/DemoClient.py
+ 1. Install the thrift package to your local Python environment: pip3
install thrift
2. Execute {python DemoClient.py <host> <port>}.
* PHP: hbase-examples/src/main/php/DemoClient.php
diff --git a/hbase-examples/src/main/python/thrift1/DemoClient.py
b/hbase-examples/src/main/python/thrift1/DemoClient.py
index 4051528a94d..a030a95a434 100644
--- a/hbase-examples/src/main/python/thrift1/DemoClient.py
+++ b/hbase-examples/src/main/python/thrift1/DemoClient.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -20,30 +20,22 @@
import sys
import time
import os
-
-# Modify this import path to point to the correct location to thrift.
-thrift_path =
os.path.abspath('/Users/sergey/Downloads/thrift/lib/py/build/lib.macosx-10.8-intel-2.7')
-sys.path.append(thrift_path)
-gen_py_path = os.path.abspath('gen-py')
-sys.path.append(gen_py_path)
-
-from thrift import Thrift
from thrift.transport import TSocket, TTransport
from thrift.protocol import TBinaryProtocol
-from hbase.ttypes import TThriftServerType
-from hbase.Hbase import Client, ColumnDescriptor, Mutation
+from gen_py.hbase import ttypes
+from gen_py.hbase.Hbase import Client, ColumnDescriptor, Mutation
def printVersions(row, versions):
- print "row: " + row + ", values: ",
+ print("row: " + row + ", values: ", end=' ')
for cell in versions:
- print cell.value + "; ",
- print
+ print(cell.value + "; ", end=' ')
+ print()
def printRow(entry):
- print "row: " + entry.row + ", cols:",
+ print("row: " + entry.row + ", cols:", end=' ')
for k in sorted(entry.columns):
- print k + " => " + entry.columns[k].value,
- print
+ print(k + " => " + entry.columns[k].value, end=' ')
+ print()
def demo_client(host, port, is_framed_transport):
@@ -68,22 +60,22 @@ def demo_client(host, port, is_framed_transport):
# Check Thrift Server Type
serverType = client.getThriftServerType()
- if serverType != TThriftServerType.ONE:
- raise Exception("Mismatch between client and server, server type is %s" %
serverType)
+ if serverType != ttypes.TThriftServerType.ONE:
+ raise RuntimeError(f"Mismatch between client and server, server type is
{serverType}")
t = "demo_table"
#
# Scan all tables, look for the demo table and delete it.
#
- print "scanning tables..."
+ print("scanning tables...")
for table in client.getTableNames():
- print " found: %s" %(table)
+ print(f" found: {table}")
if table == t:
if client.isTableEnabled(table):
- print " disabling table: %s" %(t)
+ print(f" disabling table: {t}")
client.disableTable(table)
- print " deleting table: %s" %(t)
+ print(f" deleting table: {t}")
client.deleteTable(table)
columns = []
@@ -96,16 +88,16 @@ def demo_client(host, port, is_framed_transport):
columns.append(col)
try:
- print "creating table: %s" %(t)
+ print(f"creating table: {t}")
client.createTable(t, columns)
- except AlreadyExists, ae:
- print "WARN: " + ae.message
+ except ttypes.AlreadyExists as ae:
+ print("WARN: " + ae.message)
cols = client.getColumnDescriptors(t)
- print "column families in %s" %(t)
+ print(f"column families in {t}")
for col_name in cols.keys():
col = cols[col_name]
- print " column: %s, maxVer: %d" % (col.name, col.maxVersions)
+ print(f" column: {col.name}, maxVer: {col.maxVersions}")
dummy_attributes = {}
#
@@ -116,7 +108,7 @@ def demo_client(host, port, is_framed_transport):
# non-utf8 is fine for data
mutations = [Mutation(column="entry:foo",value=invalid)]
- print str(mutations)
+ print(str(mutations))
client.mutateRow(t, "foo", mutations, dummy_attributes)
# try empty strings
@@ -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}"
mutations = [Mutation(column="unused:", value="DELETE_ME")]
client.mutateRow(t, row, mutations, dummy_attributes)
@@ -187,15 +179,15 @@ def demo_client(host, port, is_framed_transport):
r = client.get(t, row, "entry:foo", dummy_attributes)
# just to be explicit, we get lists back, if it's empty there was no
matching row.
if len(r) > 0:
- raise "shouldn't get here!"
+ raise RuntimeError("shouldn't get here!")
columnNames = []
for (col, desc) in client.getColumnDescriptors(t).items():
- print "column with name: "+desc.name
- print desc
+ print("column with name: "+desc.name)
+ print(desc)
columnNames.append(desc.name+":")
- print "Starting scanner..."
+ print("Starting scanner...")
scanner = client.scannerOpenWithStop(t, "00020", "00040", columnNames,
dummy_attributes)
r = client.scannerGet(scanner)
@@ -204,16 +196,14 @@ def demo_client(host, port, is_framed_transport):
r = client.scannerGet(scanner)
client.scannerClose(scanner)
- print "Scanner finished"
+ print("Scanner finished")
transport.close()
if __name__ == '__main__':
-
- import sys
if len(sys.argv) < 3:
- print 'usage: %s <host> <port>' % __file__
+ print(f'usage: {__file__} <host> <port>')
sys.exit(1)
host = sys.argv[1]
diff --git
a/hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
b/hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
index e2a48672b8c..357de8a88ac 100755
--- a/hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
+++ b/hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py
@@ -20,7 +20,7 @@
# test thrift server over HTTP with SSL in place
#
# presumes thrift python lib is installed
-# presumes you have access to hbase thrift binding (i.e. you add gen-py to
PYTHONPATH)
+# presumes you have access to hbase thrift binding (i.e. you add gen_py to
PYTHONPATH)
# presumes thrift proxy is running on port 9090
# presumes thrift proxy is running over https
# presumes access to create and use tables in a namespace 'test'
@@ -29,43 +29,48 @@
# ./demo_hbase_thrift_over_http_tls.py host-running-thrift1.example.com
import sys
-from thrift import Thrift
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
-from hbase import Hbase
-from hbase.ttypes import ColumnDescriptor
-from hbase.ttypes import Mutation
-from hbase.ttypes import IOError as HBaseIOError
+from gen_py.hbase import Hbase
+from gen_py.hbase.ttypes import ColumnDescriptor
+from gen_py.hbase.ttypes import Mutation
-print "[INFO] setup connection"
-transport = THttpClient.THttpClient("https://{0}:{1}".format(sys.argv[1],
9090))
+print("[INFO] setup connection")
+transport = THttpClient.THttpClient(f"https://{sys.argv[1]}:9090")
client = Hbase.Client(TBinaryProtocol.TBinaryProtocol(transport))
table='test:thrift_proxy_demo'
-print "[INFO] start client"
+print("[INFO] start client")
transport.open()
-print "[INFO] list the current tables"
-print client.getTableNames()
+print("[INFO] list the current tables")
+print(client.getTableNames())
-print "[INFO] create a table, place some data"
+print("[INFO] create a table, place some data")
client.createTable(table, [ColumnDescriptor(name ='family1:')])
-client.mutateRow(table, 'row1', [Mutation(column = 'family1:cq1', value =
'foo'), Mutation(column = 'family1:cq2', value = 'foo')], {})
-client.mutateRow(table, 'row2', [Mutation(column = 'family1:cq1', value =
'bar'), Mutation(column = 'family1:cq2', value = 'bar')], {})
-client.mutateRow(table, 'row3', [Mutation(column = 'family1:cq1', value =
'foo'), Mutation(column = 'family1:cq2', value = 'foo')], {})
-client.mutateRow(table, 'row4', [Mutation(column = 'family1:cq1', value =
'bar'), Mutation(column = 'family1:cq2', value = 'bar')], {})
+client.mutateRow(table, 'row1',
+ [Mutation(column = 'family1:cq1', value = 'foo'),
+ Mutation(column = 'family1:cq2', value = 'foo')], {})
+client.mutateRow(table, 'row2',
+ [Mutation(column = 'family1:cq1', value = 'bar'),
+ Mutation(column = 'family1:cq2', value = 'bar')], {})
+client.mutateRow(table, 'row3',
+ [Mutation(column = 'family1:cq1', value = 'foo'),
+ Mutation(column = 'family1:cq2', value = 'foo')], {})
+client.mutateRow(table, 'row4',
+ [Mutation(column = 'family1:cq1', value = 'bar'),
+ Mutation(column = 'family1:cq2', value = 'bar')], {})
-
-print "[INFO] scan"
+print("[INFO] scan")
scan_id = client.scannerOpen(table, 'row1', [], {})
for row in client.scannerGetList(scan_id, 25):
- print row
+ print(row)
client.scannerClose(scan_id)
-print "[INFO] get"
+print("[INFO] get")
for row in client.getRow(table, 'row3', {}):
- print row
+ print(row)
-print "[INFO] clean up"
+print("[INFO] clean up")
client.disableTable(table)
client.deleteTable(table)
diff --git a/hbase-examples/src/main/python/thrift1/gen-py/hbase/__init__.py
b/hbase-examples/src/main/python/thrift1/gen-py/hbase/__init__.py
deleted file mode 100644
index 31dc15ce46e..00000000000
--- a/hbase-examples/src/main/python/thrift1/gen-py/hbase/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__all__ = ['ttypes', 'constants', 'Hbase']
diff --git a/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote
b/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase-remote
similarity index 100%
rename from hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote
rename to hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase-remote
diff --git a/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase.py
b/hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase.py
rename to hbase-examples/src/main/python/thrift1/gen_py/hbase/Hbase.py
diff --git a/hbase-examples/src/main/python/thrift1/gen_py/hbase/__init__.py
b/hbase-examples/src/main/python/thrift1/gen_py/hbase/__init__.py
new file mode 100644
index 00000000000..fdadcfc1e8c
--- /dev/null
+++ b/hbase-examples/src/main/python/thrift1/gen_py/hbase/__init__.py
@@ -0,0 +1,18 @@
+'''
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+'''
+__all__ = ['ttypes', 'constants', 'Hbase']
diff --git a/hbase-examples/src/main/python/thrift1/gen-py/hbase/constants.py
b/hbase-examples/src/main/python/thrift1/gen_py/hbase/constants.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift1/gen-py/hbase/constants.py
rename to hbase-examples/src/main/python/thrift1/gen_py/hbase/constants.py
diff --git a/hbase-examples/src/main/python/thrift1/gen-py/hbase/ttypes.py
b/hbase-examples/src/main/python/thrift1/gen_py/hbase/ttypes.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift1/gen-py/hbase/ttypes.py
rename to hbase-examples/src/main/python/thrift1/gen_py/hbase/ttypes.py
diff --git a/hbase-examples/src/main/python/thrift2/DemoClient.py
b/hbase-examples/src/main/python/thrift2/DemoClient.py
index 4e8107a1b5c..720c3ae9c32 100644
--- a/hbase-examples/src/main/python/thrift2/DemoClient.py
+++ b/hbase-examples/src/main/python/thrift2/DemoClient.py
@@ -1,5 +1,5 @@
+#!/usr/bin/env python
"""
-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,30 +22,22 @@
# /hbase/thrift2/hbase.thrift
# 2. Create a directory of your choosing that contains:
# a. This file (DemoClient.py).
-# b. The directory gen-py/hbase (generated by instruction step 1).
+# b. The directory gen_py/hbase (generated by instruction step 1).
# 3. pip install thrift==0.9.3
# 4. Create a table call "example", with a family called "family1" using the
hbase shell.
# 5. Start the hbase thrift2 server
# bin/hbase thrift2 start
# 6. Execute {python DemoClient.py}.
-import sys
-import os
-import time
-
from thrift.transport import TTransport
from thrift.transport import TSocket
-from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
+from gen_py.hbase import THBaseService
+from gen_py.hbase import ttypes
-# Add path for local "gen-py/hbase" for the pre-generated module
-gen_py_path = os.path.abspath('gen-py')
-sys.path.append(gen_py_path)
-from hbase import THBaseService
-from hbase.ttypes import *
-
-print "Thrift2 Demo"
-print "This demo assumes you have a table called \"example\" with a column
family called \"family1\""
+print("Thrift2 Demo")
+print('This demo assumes you have a table called '
+ '"example" with a column family called "family1"')
host = "localhost"
port = 9090
@@ -63,19 +55,20 @@ transport.open()
# Check Thrift Server Type
serverType = client.getThriftServerType()
-if serverType != TThriftServerType.TWO:
- raise Exception("Mismatch between client and server, server type is %s" %
serverType)
+if serverType != ttypes.TThriftServerType.TWO:
+ raise RuntimeError(f"Mismatch between client and server, server type is
{serverType}")
table = "example"
-put = TPut(row="row1",
columnValues=[TColumnValue(family="family1",qualifier="qualifier1",value="value1")])
-print "Putting:", put
+t_column_values =
ttypes.TColumnValue(family="family1",qualifier="qualifier1",value="value1")
+put = ttypes.TPut(row="row1", columnValues=[t_column_values])
+print("Putting:", put)
client.put(table, put)
-get = TGet(row="row1")
-print "Getting:", get
+get = ttypes.TGet(row="row1")
+print("Getting:", get)
result = client.get(table, get)
-print "Result:", result
+print("Result:", result)
transport.close()
diff --git a/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py
b/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py
deleted file mode 100644
index 378715da5e5..00000000000
--- a/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__all__ = ['ttypes', 'constants', 'THBaseService']
diff --git
a/hbase-examples/src/main/python/thrift2/gen-py/hbase/THBaseService-remote
b/hbase-examples/src/main/python/thrift2/gen_py/hbase/THBaseService-remote
similarity index 100%
rename from
hbase-examples/src/main/python/thrift2/gen-py/hbase/THBaseService-remote
rename to
hbase-examples/src/main/python/thrift2/gen_py/hbase/THBaseService-remote
diff --git
a/hbase-examples/src/main/python/thrift2/gen-py/hbase/THBaseService.py
b/hbase-examples/src/main/python/thrift2/gen_py/hbase/THBaseService.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift2/gen-py/hbase/THBaseService.py
rename to hbase-examples/src/main/python/thrift2/gen_py/hbase/THBaseService.py
diff --git a/hbase-examples/src/main/python/thrift2/gen_py/hbase/__init__.py
b/hbase-examples/src/main/python/thrift2/gen_py/hbase/__init__.py
new file mode 100644
index 00000000000..846ef400373
--- /dev/null
+++ b/hbase-examples/src/main/python/thrift2/gen_py/hbase/__init__.py
@@ -0,0 +1,18 @@
+'''
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+'''
+__all__ = ['ttypes', 'constants', 'THBaseService']
diff --git a/hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py
b/hbase-examples/src/main/python/thrift2/gen_py/hbase/constants.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py
rename to hbase-examples/src/main/python/thrift2/gen_py/hbase/constants.py
diff --git a/hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py
b/hbase-examples/src/main/python/thrift2/gen_py/hbase/ttypes.py
similarity index 100%
rename from hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py
rename to hbase-examples/src/main/python/thrift2/gen_py/hbase/ttypes.py
diff --git a/hbase-server/src/main/python/hbase/merge_conf.py
b/hbase-server/src/main/python/hbase/merge_conf.py
index ff6dfacf5bf..5e09578215a 100644
--- a/hbase-server/src/main/python/hbase/merge_conf.py
+++ b/hbase-server/src/main/python/hbase/merge_conf.py
@@ -123,7 +123,7 @@ class MergeConfTool:
return self.whole_text(self.only_element(tag_name))
def fatal(self, msg):
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
sys.exit(1)
def only_element(self, tag_name):