Add notes to `ImportError` for common issues
Offen
Dieses Issue hat noch niemand übernommen.
interpreter-core
topic-importlib
type-feature
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature or enhancement
Proposal:
ImportErrors are very common, and almost always dependent on the interpreter initialization and/or environment setup. There are many common issues we could try to detect, and give users hints on the possible cause.
- Failing to load native modules when a module for a different ABI is available
- Eg. https://github.com/python/cpython/issues/127294#issuecomment-2501787837
- A
.cp313t-win_amd64.pydmodule is available, but we were looking for.cp313-win_amd64.pyd
- A
- Eg. https://github.com/python/cpython/issues/127294#issuecomment-2501787837
- Failing to import a non-stdlib module with the
siteinitialization disabled (-S) - Failing to import a module available in the user site-packages with the user
siteinitialization disabled (-s) - Failing to import a module available in
.withPYTHONSAFEPATH/-Penabled - Failing to import a module when ignoring
PYTHON*environment variables (-E) butPYTHONPATHorPYTHONHOMEare set (which users might be relying on) - (suggest more!)
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-136817
- gh-136821
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Im Issue sind keine Quelldateien oder Tests genannt. Prüfe zuerst die verknüpften PRs gh-136817 und gh-136821 und verfolge anschließend die für die ausgewählten Umgebungsfälle relevante ImportError-Behandlung; abgeschlossen ist die Aufgabe, wenn hilfreiche Hinweise für die vereinbarten Fälle hinzugefügt und getestet wurden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- developer-experience
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100