On Wednesday, August 26, 2015 at 5:59:12 PM UTC+2, Chris Angelico wrote:

> On Thu, Aug 27, 2015 at 1:02 AM, RAH 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.
> 
> ChrisA

Hello Chris,

Thanks for your further input.

os.environ{"LANG"} returns `en_US.UTF-8`, exactly the same as asking in Bash
`echo $LANG`. But again this is the interpreter.

Now if I ask the same os.environ["LANG"] within my application, it returns `C`

So, again, there is a marked difference between what the interpreter shows and 
what the run-time shows.

In the meantime, I have checked the configuration directives of mod_wsgi. There 
is nothing there to set or choose a particular environment. And I wonder if 
there is a reason to check the Apache2 directives, like SetEnv ? Indeed Apache2 
doesn't know anything about Python.

On the other hand the server I use (Ubuntu) still has Python 2.7 installed and 
I can't remove it with apt-get. I believe Ubuntu needs python a lot. The Python 
3.4 has been installed separately and it could be that a doubtful configuration 
subsists.

Nevertheless I can't figure out why calling Python in the shell (interactive 
mode) or letting mod_wsgi start the same Python provide two different 
environments. I guess I must investigate that part because mod_wsgi gets to 
Python in what I would call 'auto-discovery' mode. Obviously it gets the same 
version 3.4.0 but maybe it picks up some 2.7 configuration files because the 
installation of 3.4 next to 2.7 might not be perfect. I'll look at it.

Thank you Chris. If I find something I'll post it here.
René
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to