forked from qt-creator/qt-creator
Python: Fix python detection for non project files
Do not return an empty file path if we cannot find a python venv for a file path, but also consider the configured interpreters. Change-Id: I5a7f06e394fb925f9a00143fc5f0797e8754534b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -67,8 +67,8 @@ FilePath detectPython(const FilePath &documentPath)
|
||||
|
||||
// check whether this file is inside a python virtual environment
|
||||
QList<Interpreter> venvInterpreters = PythonSettings::detectPythonVenvs(documentPath);
|
||||
if (!python.exists())
|
||||
python = venvInterpreters.value(0).command;
|
||||
if (!python.exists() && !venvInterpreters.isEmpty())
|
||||
python = venvInterpreters.first().command;
|
||||
|
||||
if (!python.exists())
|
||||
python = PythonSettings::defaultInterpreter().command;
|
||||
|
||||
Reference in New Issue
Block a user