python / python/cpython

Include the current working dir in FileNotFoundError

Abierto
#93,431 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.13 interpreter-core type-feature
Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Merge medio
1 d 9 h
PR fusionados (30 d)
558

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza rastreando dónde Python genera FileNotFoundError para las rutas relativas y revisa el comportamiento relacionado de Popen() mencionado en el issue. El cambio estará completo cuando una ruta relativa inexistente informe del directorio de trabajo actual, preservando al mismo tiempo el comportamiento útil de los errores para las rutas resueltas mediante PATH.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
operating-systems
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.