file.write() of non-ASCII characters differs in Interpreted Python than in script run

Chris Angelico rosuav at
Wed Aug 26 17:57:57 CEST 2015

On Thu, Aug 27, 2015 at 1:02 AM, RAH <rene.heymans at> wrote:
> 7) Now, that source of the problem is known, I must investigate why my run-time environment differs from the interpreter environment. I know it is the same machine, same Python 3.4.0. As the mod_wsgi module in Apache2 initiates Python for the run-time, I will look there around.

First place to look would be the environment. If os.environ["LANG"]
has "C" when you run under Apache, that would be the explanation. But
explicitly choosing the encoding is the best way for other reasons
anyway, and it solves the problem, so researching this is merely a
matter of curiosity.


More information about the Python-list mailing list