laurentprudhon / nlptextdoc

Suite of tools to extract and annotate language resources for NLP applications
Other
1 stars 2 forks source link

Limit file path size to 255 chars #16

Closed laurentprudhon closed 5 years ago

laurentprudhon commented 5 years ago

When some file paths are larger than 255 chars on Windows, errors appear in Python functions and Windows tools like Notepad when trying to reading them :

FileNotFoundError: [Errno 2] No such file or directory: 'D:\Laurent\nlptextdoc\www.ag2rlamondiale.fr\chefs-d-entreprise-et-tns\reseaux-et-partenariats-professionnels\tout-savoir-sur-le-partenariat-entre-le-syndicat-national-des-medecins-specialises-en-orl-et-chirurgie-cervico-faciale-snorl-et-ag2r-la-mondiale.nlp.txt'

=> limit them to 255 chars while generating the file names

A lot of examples in the following section : www.boursorama.com/aide-en-ligne

laurentprudhon commented 5 years ago

Found a possible fix in Python 3.7 / Windows 10-1810 : append //?/ before the path to support long path names.

from pathlib import Path rootdir = Path("//?/D:...")

laurentprudhon commented 5 years ago

Fix applied and working well in the latest version of the nlptextdoc Python library : "nlptextdoc-lib-v1.ipynb"