Open() on path that exceeds 248 char limit results in "FileNotFoundError: [Errno 2] No such file or directory"
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
Attempting to open or appending paths to sys.path with paths that length exceed the 248 character limit results in incorrect errors. In the case of opening paths that exceeded the limit, rather than an error pointing to the path length being exceeded we see a file not found. A similar error handling issue is prevalent with appending paths that exceed the limit to sys.path. In this case when trying to access the module you will receive a module not found error. I am now aware the path limit can be disabled on installation or later but these false flags led me astray while debugging.
Reproduction Steps:
- Create a text file whose path exceeds 248 characters
- Attempt to read/write from that file
or - Create a Python module whose path exceeds 248 characters
- Attempt to import that module from an external directory by appending the path to sys.path
Environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Windows x64
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 il comportamento segnalato su Windows x64 con Python 3.10.4: apri un file il cui percorso supera 248 caratteri, quindi prova a importare un modulo da un percorso troppo lungo aggiunto a sys.path. Traccia gli errori di apertura e importazione per identificare dove viene persa la condizione sulla lunghezza. Il lavoro è completato quando entrambi i casi segnalano un errore accurato sulla lunghezza del percorso invece di FileNotFoundError o ModuleNotFoundError.
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
- Abbastanza chiara
- Idoneità per principianti
- 35/100