[GRASS-user] exwcuting grass python script from php web page

roberta fagandini robifagandini at hotmail.it
Mon Sep 28 03:10:36 PDT 2020


Hi all!
I wrote a python script with grass to be run from a php web page.
The python script works perfectly if I run it from the terminal but when I try to run it from the php web page, the grass related part seems to be ignored and the grass session is not launched. I set the grass gis environment following this link [0].
>From the php side, I try to launch the python script using both exec(), system() and also a bash script to run the python script but I always got the same error.
Attached you can find the python script.

Does anybody have any ideas on how to fix it?

Thanks in advance for the help!
Roberta

[0] https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7_with_existing_location
Working with GRASS without starting it explicitly - GRASS-Wiki - GRASS-Wiki - GRASS-Wiki<https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7_with_existing_location>
GRASS sessions. It is possible to access GRASS modules without explicitly starting a "GRASS session". GRASS libraries require certain environment variables to be set. In fact a "GRASS session" is just a set of processes (e.g. a shell and/or GUI) which have the necessary environment settings, specifically:
grasswiki.osgeo.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200928/532654a0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: importgrass.py
Type: text/x-python
Size: 2092 bytes
Desc: importgrass.py
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200928/532654a0/attachment.py>


More information about the grass-user mailing list