quanteda / readtext

an R package for reading text files
https://readtext.quanteda.io
120 stars 28 forks source link

Readtext gives uninformative error message when file paths are too long #173

Open alohacocoa opened 1 year ago

alohacocoa commented 1 year ago

In my root directory I have a folder called "Text folders" that contains 50 folders, each with one PDF inside. I have run the code that extracts these texts dozens of times already without any problems. After migrating my root directory to another place, I suddenly got an error message:

Error in list_files(file, ignore_missing, TRUE, verbosity) : File '' does not exist.

It took quite a bit of time to diagnose that readtext() had trouble reading exactly two out of the 50 files. Incidentally, those two files are also in the two folders with the longest names. After renaming these folders to something else, everything worked again normally.

I think ideally there should be a distinct warning if a file can't be extracted due to file paths being too long.