From 53e3a74bc85c88847d71f0fffa06ec66d5210f48 Mon Sep 17 00:00:00 2001 From: orangelzh <43107636+orangelzh@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:12:42 +0800 Subject: [PATCH] Update python_runner.py Fix the bug of calculating the length of parameters in st2, when encountering Chinese, etc., non-English characters, the old calculation method will be shorter than the actual length, causing the command line to execute an extremely long error. --- contrib/runners/python_runner/python_runner/python_runner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/runners/python_runner/python_runner/python_runner.py b/contrib/runners/python_runner/python_runner/python_runner.py index a8200e0bb3..a8022b867d 100644 --- a/contrib/runners/python_runner/python_runner/python_runner.py +++ b/contrib/runners/python_runner/python_runner/python_runner.py @@ -188,7 +188,8 @@ def run(self, action_parameters): # failure to fork the wrapper process when using large parameters. stdin = None stdin_params = None - if len(serialized_parameters) >= MAX_PARAM_LENGTH: + serialized_parameters_bytes = serialized_parameters.encode('utf-8') + if len(serialized_parameters_bytes) >= MAX_PARAM_LENGTH: stdin = subprocess.PIPE LOG.debug("Parameters are too big...changing to stdin") stdin_params = '{"parameters": %s}\n' % (serialized_parameters)