I'm trying to run rqworker as an attached-daemon in UWSGI. To do this I add to the config.ini file:
attach-daemon = /path/to/rqworker
Then UWSGI tries to launch rqworker when it should but I get the following error in the logs:
RuntimeError: Click will abort further execution because Python 3 was
configured to use ASCII as encoding for the environment. Either switch
to Python 2 or consult http://click.pocoo.org/python3/ for mitigation
I can run rqworker fine from bash but the encoding seems to be not set correctly for the daemon.
From the linked page in that message:
You are dealing with an environment where Python 3 thinks you are restricted to ASCII data. The solution to these problems is different depending on which locale your computer is running in.
For instance, if you have a German Linux machine, you can fix the problem by exporting the locale to de_DE.utf-8:
export LC_ALL=de_DE.utf-8 export LANG=de_DE.utf-8 If you are on a US machine, en_US.utf-8 is the encoding of choice. On some newer Linux systems, you could also try C.UTF-8 as the locale:
export LC_ALL=C.UTF-8 export LANG=C.UTF-8
To set the encoding in the UWSGI config.ini file you can use "env" to set environment variables and in turn the locale. On a US machine this configuration would work:
env = LC_ALL=en_US.utf-8 env = LANG=en_US.utf-8 attach-daemon = /path/to/rqworker
On other machines, various other encodings could be used.