Include the current working dir in FileNotFoundError
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Feature or enhancement
A FileNotFoundError exception should include the current working directory when referring to a relative path.
Pitch
The problem this solves is with relative paths. If you just get the error "foo/bar not found", it is not enough info to fully understand the problem, because whether this can be found depends on the working directory as well.
At the moment, I'm working with Bazel (a build system), which does its form of sandboxing by symlinking things into a separate directory and building there. This implies both creating files/symlinks and switching directories and a lot of that. When a file is not found, it can mean that either of the two operations were faulty, but with a relative path you absolutely need the working directory to say which is the case.
Note that there is another category of similar problems, where e.g. Popen() tries to locate an executable using the PATH environment variable. Here, the simple executable file name is not helpful without the directories that were searched.
Previous discussion
I have found #60389, which is also related to missing info in such an error. Apart from that, I haven't found any similar discussions.
Linked PRs
- gh-116071
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando dove Python solleva FileNotFoundError per i percorsi relativi e verifica il comportamento correlato di Popen() menzionato nell’issue. La modifica è completa quando un percorso relativo mancante segnala la directory di lavoro corrente, preservando al contempo un comportamento utile degli errori per i percorsi risolti tramite PATH.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100