librelist archives

« back to archive

.pyc files

.pyc files

From:
Liam J Thompson
Date:
2014-02-07 @ 11:22
hi everyone

I have a Flask app (in virtualenv, --no-site-packages) running on Apache 
2.4 with mod_wsgi, python2.7.

When I activate the virtualenv manually, I don't get errors when I run 
the request, and it returns "Hello World" as it should, nice and clean.

When I leave it up to Apache to activate the Virtualenv, and I perform 
the URL request, I start getting alot of errors in the logs. It seems to 
want to create .pyc files in the /usr/lib/python2.7 directory, but can't 
for some reason (probably permissions). It still returns "Hello World" 
as it should though.

Here are some examples of the output in http://bpaste.net/show/176199/

As the output shows for the packages or files it tries to import from 
the virtualenv, I don't see these errors. It only has a problem with 
those it tries to access in the system python directory.

Is this normal ? I would think Apache has activated the virtualenv just 
fine if it is returning as it should, but I don't understand the 
presence of all the log errors.

Any ideas ?

many thanks

Liam

Re: [flask] .pyc files

From:
Leiser Fernandez Gallo
Date:
2014-02-07 @ 14:42
python don't need the .pyc files for run, it's just a "cache", then they 
don't need write permitions to work. 


----- Mensaje original -----
> hi everyone
> 
> I have a Flask app (in virtualenv, --no-site-packages) running on Apache
> 2.4 with mod_wsgi, python2.7.
> 
> When I activate the virtualenv manually, I don't get errors when I run
> the request, and it returns "Hello World" as it should, nice and clean.
> 
> When I leave it up to Apache to activate the Virtualenv, and I perform
> the URL request, I start getting alot of errors in the logs. It seems to
> want to create .pyc files in the /usr/lib/python2.7 directory, but can't
> for some reason (probably permissions). It still returns "Hello World"
> as it should though.
> 
> Here are some examples of the output in http://bpaste.net/show/176199/
> 
> As the output shows for the packages or files it tries to import from
> the virtualenv, I don't see these errors. It only has a problem with
> those it tries to access in the system python directory.
> 
> Is this normal ? I would think Apache has activated the virtualenv just
> fine if it is returning as it should, but I don't understand the
> presence of all the log errors.
> 
> Any ideas ?
> 
> many thanks
> 
> Liam
> 

________________________________________________________________________________________________
III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero 
del 2014. Ver www.uci.cu

Re: [flask] .pyc files

From:
Matthias Urlichs
Date:
2014-02-07 @ 15:26
Hi,

Leiser Fernandez Gallo:
> python don't need the .pyc files for run, it's just a "cache", then they
don't need write permitions to work. 
> 
That's not the problem. The problem is that if Python still writes to
/usr/lib, this suggests that it also reads directly from there, and thus
that the VEnv is not set up correctly.
-- 
-- Matthias Urlichs

Re: [flask] .pyc files

From:
Liam J Thompson
Date:
2014-02-07 @ 15:33
This is my worry, that it has not been set up properly. However a Django 
app on the same system has been set up in the same way, but it is only 
the Flask app that is having problems. I'm not sure what to change.

Perhaps this is more a question for plain Python ?