Skip to content

Fix bug with python interpreter detection #2615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.jetbrains.python.psi.PyElement
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyFunction
import com.jetbrains.python.psi.resolve.QualifiedNameFinder
import com.jetbrains.python.sdk.pythonSdk
import mu.KotlinLogging
import org.jetbrains.kotlin.idea.base.util.module
import org.jetbrains.kotlin.idea.base.util.sdk
Expand Down Expand Up @@ -119,7 +120,7 @@ object PythonDialogProcessor {
}
}
}
val pythonPath = getPythonPath(elementsToShow)
val pythonPath = getPythonPath(project)
if (pythonPath == null) {
showErrorDialogLater(
project,
Expand Down Expand Up @@ -334,8 +335,8 @@ object PythonDialogProcessor {
}
}

fun getPythonPath(elementsToShow: Set<PyElement>): String? {
return findSrcModules(elementsToShow).first().sdk?.homePath
fun getPythonPath(project: Project): String? {
return project.pythonSdk?.homePath
}

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