From 8c12c21dc97b438612ebfceab0111b00f2cf006e Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Wed, 6 Jun 2018 14:02:54 +0200 Subject: [PATCH] force en_US.UTF-8 locale in CLAM wrapper (for all nextflow subprocesses) --- webservice/picclservice/picclservice_wrapper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webservice/picclservice/picclservice_wrapper.py b/webservice/picclservice/picclservice_wrapper.py index 03c96b1..90a49c0 100755 --- a/webservice/picclservice/picclservice_wrapper.py +++ b/webservice/picclservice/picclservice_wrapper.py @@ -18,6 +18,7 @@ import os import glob import shutil +import locale #import CLAM-specific modules. The CLAM API makes a lot of stuff easily accessible. import clam.common.data @@ -46,8 +47,10 @@ run_piccl = "nextflow run LanguageMachines/PICCL/" print("Running PICCL mediated by Nextflow",file=sys.stderr) -print("System default encoding: ", sys.getdefaultencoding(), file=sys.stderr) +print("System default encoding: ", sys.getdefaultencoding(), file=sys.stderr) +print("Forcing en_US.UTF-8 locale...", file=sys.stderr) +locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') #If you make use of CUSTOM_FORMATS, you need to import your service configuration file here and set clam.common.data.CUSTOM_FORMATS #Moreover, you can import any other settings from your service configuration file as well: @@ -58,7 +61,7 @@ clamdata = clam.common.data.getclamdata(datafile) if 'debug' in clamdata and clamdata['debug']: - print("Locale information: ", file=sys.stderr) + print("Locale information (will force en_US.UTF-8): ", file=sys.stderr) os.system("locale >&2", file=sys.stderr) #You now have access to all data. A few properties at your disposition now are: