From be1437c797d82c1f69301e3f048032d51aee1d4b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 6 Apr 2022 10:42:54 +0200 Subject: [PATCH] Fix opening terminal with macOS 12.3 macOS removed support for Python2, so switch to Python3 (and fix that we now need to specify text mode for a temporary file if we want to write text there, not binary data). Fixes: QTCREATORBUG-27337 Change-Id: I4884480c32e017aa710f90ab0b5afe493a2adb9e Reviewed-by: Reviewed-by: Christian Stenger --- share/qtcreator/scripts/openTerminal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/scripts/openTerminal.py b/share/qtcreator/scripts/openTerminal.py index a0347c08674..8bab290d43e 100755 --- a/share/qtcreator/scripts/openTerminal.py +++ b/share/qtcreator/scripts/openTerminal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # @@ -102,7 +102,7 @@ def bash_setup(shell): def main(): # create temporary file to be sourced into bash that deletes itself - with NamedTemporaryFile(delete=False) as shell_script: + with NamedTemporaryFile(mode='wt', delete=False) as shell_script: shell = os.environ.get('SHELL') shell, system_login_script, login_script, non_interactive_shell, interactive_shell = ( zsh_setup(shell) if shell is not None and shell.endswith('/zsh')