diff --git a/automation_editor/extend/process_executor/task_process_manager.py b/automation_editor/extend/process_executor/task_process_manager.py index c434838..4ff6ba4 100644 --- a/automation_editor/extend/process_executor/task_process_manager.py +++ b/automation_editor/extend/process_executor/task_process_manager.py @@ -1,6 +1,4 @@ -import os import queue -import shutil import subprocess import sys import threading @@ -14,8 +12,6 @@ from je_editor.utils.venv_check.check_venv import check_and_choose_venv from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow -from automation_editor.utils.exception.exception_tags import compiler_not_found_error -from automation_editor.utils.exception.exceptions import ITEExecException class TaskProcessManager(object): @@ -24,7 +20,7 @@ def __init__( main_window: CodeWindow, task_done_trigger_function: typing.Callable = None, error_trigger_function: typing.Callable = None, - program_buffer_size: int = 1024000, + program_buffer_size: int = 1024, program_encoding: str = "utf-8" ): super().__init__() @@ -57,7 +53,7 @@ def renew_path(self) -> None: def start_test_process(self, package: str, exec_str: str): self.renew_path() - self.process = subprocess.Popen( + self.process: subprocess.Popen = subprocess.Popen( [ self.compiler_path, "-m", @@ -144,13 +140,14 @@ def print_and_clear_queue(self): def read_program_output_from_process(self): while self.still_run_program: - program_output_data = self.process.stdout.raw.read(self.program_buffer_size).decode(self.program_encoding) + self.process: subprocess.Popen + program_output_data = self.process.stdout.read(self.program_buffer_size).decode(self.program_encoding) if program_output_data.strip() != "": self.run_output_queue.put(program_output_data) def read_program_error_output_from_process(self): while self.still_run_program: - program_error_output_data = self.process.stderr.raw.read(self.program_buffer_size).decode( + program_error_output_data = self.process.stderr.read(self.program_buffer_size).decode( self.program_encoding) if program_error_output_data.strip() != "": self.run_error_queue.put(program_error_output_data)