From b7a325360ca8ae3107411e9e1966d93b999bbb52 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 8 Jan 2020 21:56:29 +0100 Subject: datacite: catch type mismatch in language detection --- python/fatcat_tools/importers/datacite.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index aaf1af2c..fc986994 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -584,9 +584,8 @@ class DataciteImporter(EntityImporter): lang = None try: lang = langdetect.detect(text) - except langdetect.lang_detect_exception.LangDetectException as err: - print('[{}] language detection failed: {}'.format(doi, err), - file=sys.stderr) + except (langdetect.lang_detect_exception.LangDetectException, TypeError) as err: + print('[{}] language detection failed with {} on {}'.format(doi, err, text), file=sys.stderr) abstracts.append( fatcat_openapi_client.ReleaseAbstract( mimetype="text/plain", -- cgit v1.2.3