From b64a75d4407ef42135802e5afc1989ebeb5f0175 Mon Sep 17 00:00:00 2001 From: blackholll Date: Sat, 15 Jun 2019 21:27:19 +0800 Subject: [PATCH] bugfix: run script and nocice script raise exception when include chinese character --- tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 62abcb6b..59e9a287 100644 --- a/tasks.py +++ b/tasks.py @@ -89,7 +89,7 @@ def run_flow_task(ticket_id, script_id_str, state_id, action_from='loonrobot'): try: with stdoutIO() as s: # execfile(script_file, globals) # for python 2 - exec(open(script_file).read(), globals) + exec(open(script_file, encoding='utf-8').read(), globals) script_result = True # script_result_msg = ''.join(s.buflist) script_result_msg = ''.join(s.getvalue()) @@ -211,7 +211,7 @@ def send_ticket_notice(ticket_id): try: with stdoutIO() as s: # execfile(script_file, globals) # for python 2 - exec(open(notice_script_file).read(), globals) + exec(open(notice_script_file, encoding='utf-8').read(), globals) script_result = True # script_result_msg = ''.join(s.buflist) script_result_msg = ''.join(s.getvalue())