Skip to content

Commit 423014b

Browse files
committed
force en_US.UTF-8 locale in CLAM wrapper (for all nextflow subprocesses) (wild guess for possible fix for LanguageMachines/ticcltools#18)
1 parent f9965ed commit 423014b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

webservice/picclservice/picclservice_wrapper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import os
1919
import glob
2020
import shutil
21+
import locale
2122

2223
#import CLAM-specific modules. The CLAM API makes a lot of stuff easily accessible.
2324
import clam.common.data
@@ -46,8 +47,10 @@
4647
run_piccl = "nextflow run LanguageMachines/PICCL/"
4748
print("Running PICCL mediated by Nextflow",file=sys.stderr)
4849

49-
print("System default encoding: ", sys.getdefaultencoding(), file=sys.stderr)
5050

51+
print("System default encoding: ", sys.getdefaultencoding(), file=sys.stderr)
52+
print("Forcing en_US.UTF-8 locale...", file=sys.stderr)
53+
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
5154

5255
#If you make use of CUSTOM_FORMATS, you need to import your service configuration file here and set clam.common.data.CUSTOM_FORMATS
5356
#Moreover, you can import any other settings from your service configuration file as well:
@@ -58,7 +61,7 @@
5861
clamdata = clam.common.data.getclamdata(datafile)
5962

6063
if 'debug' in clamdata and clamdata['debug']:
61-
print("Locale information: ", file=sys.stderr)
64+
print("Locale information (will force en_US.UTF-8): ", file=sys.stderr)
6265
os.system("locale >&2", file=sys.stderr)
6366

6467
#You now have access to all data. A few properties at your disposition now are:

0 commit comments

Comments
 (0)