Обсуждение: Problem setting environmental variables for postgresql or plpythonu

Поиск
Список
Период
Сортировка

Problem setting environmental variables for postgresql or plpythonu

От
Mark Wynter
Дата:
I''m hoping someone can help me out.   I'm wanting to run GRASS GIS from within a plpythonu function block.  But to run
GRASSGIS externally, the following environmental variables need to be available to the Postgresql server... 

GISBASE='/usr/local/grass-6.4.3svn'
PATH='$PATH:$GISBASE/bin:$GISBASE/scripts:$GISBASE/lib'
PYTHONPATH='${PYTHONPATH}:$GISBASE/etc/python/'
PYTHONPATH='${PYTHONPATH}:$GISBASE/etc/python/grass'
PYTHONPATH='${PYTHONPATH}:$GISBASE/etc/python/grass/script'
LD_LIBRARY_PATH='$LD_LIBRARY_PATH:$GISBASE/lib'
GIS_LOCK='$$'
GISRC='$HOME/.grassrc6'

Reference:  http://grass.osgeo.org/wiki/GRASS_and_Python

So far I've added these variables to /etc/bash.bashrc
which makes them available to the postgres user (but not the server or pl/python).

And I've had no success adding them to...
/etc/postgresql/9.1/main/environment
#Shell commands are not evaluated.

Any suggestions would be appreciated...

Thanks
Mark

Re: Problem setting environmental variables for postgresql or plpythonu

От
"Albe Laurenz"
Дата:
Mark Wynter wrote:
> I''m hoping someone can help me out.   I'm wanting to run GRASS GIS
from within a plpythonu function
> block.  But to run GRASS GIS externally, the following environmental
variables need to be available to
> the Postgresql server...

[...]

> So far I've added these variables to /etc/bash.bashrc
> which makes them available to the postgres user (but not the server or
pl/python).
>
> And I've had no success adding them to...
> /etc/postgresql/9.1/main/environment
> #Shell commands are not evaluated.
>
> Any suggestions would be appreciated...

What if you set the environment variables in the Python function?
I don't speak Python, but I guess you can set environment
variables in this language.

Other than that, it would be interesting to know which
operating system you are using and how you start the server.

On Linux for example, it works quite fine to export a
variable and then start the server with "pg_ctl start".

Yours,
Laurenz Albe