Skip to content

Commit d4564dd

Browse files
authored
Fix bug with python interpreter detection (#2615)
1 parent 9ad3c5b commit d4564dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogProcessor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.jetbrains.python.psi.PyElement
2424
import com.jetbrains.python.psi.PyFile
2525
import com.jetbrains.python.psi.PyFunction
2626
import com.jetbrains.python.psi.resolve.QualifiedNameFinder
27+
import com.jetbrains.python.sdk.pythonSdk
2728
import mu.KotlinLogging
2829
import org.jetbrains.kotlin.idea.base.util.module
2930
import org.jetbrains.kotlin.idea.base.util.sdk
@@ -119,7 +120,7 @@ object PythonDialogProcessor {
119120
}
120121
}
121122
}
122-
val pythonPath = getPythonPath(elementsToShow)
123+
val pythonPath = getPythonPath(project)
123124
if (pythonPath == null) {
124125
showErrorDialogLater(
125126
project,
@@ -334,8 +335,8 @@ object PythonDialogProcessor {
334335
}
335336
}
336337

337-
fun getPythonPath(elementsToShow: Set<PyElement>): String? {
338-
return findSrcModules(elementsToShow).first().sdk?.homePath
338+
fun getPythonPath(project: Project): String? {
339+
return project.pythonSdk?.homePath
339340
}
340341

341342
fun findSrcModules(elements: Collection<PyElement>): List<Module> {

0 commit comments

Comments
 (0)