pathlib.Path.touch incorrectly raises 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
Bug report
In ipython, the first two calls to pathlib.Path.touch succeed but the third fails. I see no reason that it should fail, and if it should, the error raised is incorrect.
from pathlib import Path
log_filename = Path('/mnt/c/Users/Michael/OneDrive/PycharmProjects/beta_numbers/logs/perron_numbers_log0.txt')
log_filename.touch() # success
log_filename = Path('/mnt/c/Users/Michael/OneDrive/PycharmProjects/beta_numbers/logs/perron_numbers_log_.txt')
log_filename.touch() # success
log_filename = Path('/mnt/c/Users/Michael/OneDrive/PycharmProjects/beta_numbers/logs/perron_numbers_log_0.txt')
log_filename.touch()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/pathlib.py", line 1166, in touch
self._accessor.touch(self, mode, exist_ok)
File "/usr/lib/python3.10/pathlib.py", line 331, in touch
fd = os.open(path, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/c/Users/Michael/OneDrive/PycharmProjects/beta_numbers/logs/perron_numbers_log_0.txt'
Contents of /mnt/c/Users/Michael/OneDrive/PycharmProjects/beta_numbers/logs prior to the first touch:
- -3_-1_-7.log
- -7_-29_-43.log
- -8_-3_-17.log
- -9_-35_-51.log
- analyze.log
- find_close_orbit.log
- test_log.txt
- testy.log
- update_legacy_data.log
Your environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Ubuntu 22.04 run on a Windows 10 x64 device through WSL2
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 riproducendo le tre chiamate a pathlib.Path.touch su CPython 3.10.4 in Ubuntu 22.04 su WSL2, quindi esamina pathlib.py alle righe 1166 e 331. Determina se il FileNotFoundError segnalato è riproducibile e quale condizione del filesystem lo causa; il lavoro è concluso quando è disponibile una diagnosi confermata con un test di regressione mirato o una spiegazione documentata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100