From d60fa5c762af1d41f54603e19fbc083a94c70bc2 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 10 Nov 2020 10:28:10 +0100 Subject: [PATCH] Python: Improve auto detection Do not list app installer redirectors as python executables. Windows may put empty redirector files with the same name in a path that is prepended to PATH for the respective user. Change-Id: I9418784ef099df72ef8d0426e55198b30fbeed6a Reviewed-by: David Schulz --- src/plugins/python/pythonsettings.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index ca5e58f8c28..01dcf671a15 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -405,6 +405,9 @@ static void addPythonsFromPath(QList &pythons) if (HostOsInfo::isWindowsHost()) { for (const FilePath &executable : env.findAllInPath("python")) { + // Windows creates empty redirector files that may interfere + if (executable.toFileInfo().size() == 0) + continue; if (executable.exists() && !alreadyRegistered(pythons, executable)) pythons << Interpreter(executable, "Python from Path"); }