JuliaPy / JuliaPy/PyCall.jl

detect ModuleNotFoundError in pyimport

Offen
#645 2 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Currently, we print `The Python package foo could not be found by pyimport` when [*any* ImportError](https://github.com/JuliaPy/PyCall.jl/blob/master/src/PyCall.jl#L490) is thrown by `pyimport`. We should only print this on a `ModuleNotFoundError`, as otherwise it is misleading.

Note that we can only do this in Python ≥ 3.6 (https://github.com/python/cpython/commit/c943265ba56e7ce7e2fe79fdecfc6670e10e5467). I guess in earlier versions we could check for `"No module named"` in the `ImportError` string?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start at src/PyCall.jl around line 490, where pyimport handles ImportError. Check how Python versions before and after 3.6 are supported, then verify that the package-not-found message is emitted only for ModuleNotFoundError or the documented earlier-version fallback; done means other ImportError cases are not reported as missing packages.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia, python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.