[Zoo-discuss] Python service doesn't see Environment variable

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Thu Dec 18 05:33:35 PST 2014


Thanks for your answer Gerald and for this: conf["main"]["tmpDir"]
I will use it instead of the environment variable
Steve



Fenoy Gerald <gerald.fenoy at geolabs.fr> 
2014-12-18 02:24

A
Steve.Toutant at inspq.qc.ca
cc
ZOO-discuss <zoo-discuss at lists.osgeo.org>
Objet
Re: [Zoo-discuss] Python service doesn't see Environment variable








Dear Steve,
for defining environment variables prior to run your service you should 
use a specific section in your main.cfg file. This section should be named 
[env] then you can define any key value pair, so for defining tmpdir as an 
environment variable you simply have to add the following to your 
main.cfg:

[env]
TMPDIR=/your/tmp/dir

Obviously you should replace « /your/tmp/dir » by a real path.

Please also note that there is already a default tmpdir variable but it is 
not defined as an environment variable but can be accessed easilly from 
any service. It is located in the [main] section and is named tmpDir. So 
to access it from your service code you may use something like : 
conf["main"]["tmpDir"] .

I hope this helps,
Best regards,

> Le 17 déc. 2014 à 20:21, Steve.Toutant at inspq.qc.ca a écrit :
> 
> I want my python process to access some environment variables 
> in a console launching this command works 
> python -c 'import os; print os.environ["TMPDIR"]' 
> 
> But when zoo execute the python process it returns an error. Same using 
getenv() 
> 
> To create the environment variable I created a .sh in /etc/profile.d/ 
> and it contains export TMPDIR="/tmp" 
> 
> How can I fix this please? 
> thanks
> _______________________________________________
> Zoo-discuss mailing list
> Zoo-discuss at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
> 



Gérald Fenoy
http://wiki.osgeo.org/wiki/User:Djay




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/zoo-discuss/attachments/20141218/62bf91f3/attachment.html>


More information about the Zoo-discuss mailing list