aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-01-08 21:56:29 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-01-08 21:56:29 +0100
commitb7a325360ca8ae3107411e9e1966d93b999bbb52 (patch)
tree88161dfb6d2386790bd47c69e1b2fa6d2c3cb2af /python
parent791c21af58554203cbfa52a7ebc1d91db261daec (diff)
downloadfatcat-b7a325360ca8ae3107411e9e1966d93b999bbb52.tar.gz
fatcat-b7a325360ca8ae3107411e9e1966d93b999bbb52.zip
datacite: catch type mismatch in language detection
Diffstat (limited to 'python')
-rw-r--r--python/fatcat_tools/importers/datacite.py5
1 files 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",