Fix for Windows

This commit is contained in:
Jonathan van der Steege 2022-07-02 11:37:26 +02:00
parent 26c79f1377
commit 509c14d6c5

View file

@ -63,7 +63,9 @@ class TextExporter:
entry_is_written = True entry_is_written = True
except OSError as oserr: except OSError as oserr:
title_length = len(str(entry.title)) title_length = len(str(entry.title))
if oserr.errno == errno.ENAMETOOLONG and title_length > 1: if (
oserr.errno == errno.ENAMETOOLONG or oserr.errno == errno.ENOENT
) and title_length > 1:
shorter_file_length = title_length // 2 shorter_file_length = title_length // 2
entry.title = str(entry.title)[:shorter_file_length] entry.title = str(entry.title)[:shorter_file_length]
else: else: