Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment
<p>I downloaded Quokka Python/Flask CMS to a CentOS7 server. Everything works fine with command</p>

<pre><code>sudo python3 manage.py runserver --host 0.0.0.0 --port 80
</code></pre>

<p>Then I create a file /etc/init.d/quokkacms. The file contains following code</p>

<pre><code>start() {
        echo -n "Starting quokkacms: "
        python3 /var/www/quokka/manage.py runserver --host 0.0.0.0 --port 80
        touch /var/lock/subsys/quokkacms
        return 0
}
stop() {
        echo -n "Shutting down quokkacms: "
        rm -f /var/lock/subsys/quokkacms
        return 0
}
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)

        ;;
    restart)
        stop
        start
        ;;

    *)
        echo "Usage: quokkacms {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $?
</code></pre>

<p>But I get error when running <code>sudo service quokkacms start</code></p>

<blockquote>
  <p>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 <a href="http://click.pocoo.org/python3/" rel="noreferrer">http://click.pocoo.org/python3/</a> for<br>
  mitigation steps.</p>
</blockquote>

<p>It seems to me that it is the bash script. How come I get different results? Also I followed instructions in the link in the error message but still had no luck.</p>

<p>[update] I had already tried the solution provided by Click before I posted this question. Check the results below (i run in root):</p>

<pre><code>[root@webserver quokka]# python3
Python 3.4.3 (default, Jan 26 2016, 02:25:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import locale
&gt;&gt;&gt; import codecs
&gt;&gt;&gt; print(locale.getpreferredencoding())
UTF-8
&gt;&gt;&gt; print(codecs.lookup(locale.getpreferredencoding()).name)
utf-8
&gt;&gt;&gt; locale.getdefaultlocale()
('en_US', 'UTF-8')
&gt;&gt;&gt; locale.CODESET
14
&gt;&gt;&gt;
</code></pre>