From d69cb533a368732d5442f22ddf06afb164d65179 Mon Sep 17 00:00:00 2001 From: Norbert Meszaros Date: Thu, 27 Mar 2025 16:04:00 +0100 Subject: [PATCH] PHOENIX-7553 Python3.13 dropped support for pipes module --- bin/queryserver.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/queryserver.py b/bin/queryserver.py index 8120d9b..c0b9f64 100755 --- a/bin/queryserver.py +++ b/bin/queryserver.py @@ -43,6 +43,15 @@ # daemon script not supported on some platforms (windows?) daemon_supported = False +def tryQuote(unquoted_input): + """ Python 2/3 compatibility hack + """ + try: + from shlex import quote as cmd_quote + except ImportError: + from pipes import quote as cmd_quote + return cmd_quote(unquoted_input) + import phoenix_queryserver_utils phoenix_queryserver_utils.setPath() @@ -68,8 +77,8 @@ if os.name == 'nt': args = subprocess.list2cmdline(args) else: - import pipes # pipes module isn't available on Windows - args = " ".join([pipes.quote(tryDecode(v)) for v in args]) + # pipes module isn't available on Windows + args = " ".join([tryQuote(tryDecode(v)) for v in args]) # HBase configuration folder path (where hbase-site.xml reside) for # HBase/Phoenix client side property override