[Qgis-user] Sextante on Mac OS X: a working solution for running GRASS commands

gene martin.laloux at gmail.com
Wed Jul 18 11:30:48 PDT 2012


For a working solution for all OS, in GrassUtils.py (with GRASS 6.4.app):

def executeGrass(commands, progress):
        if SextanteUtils.isWindows():
            GrassUtils.createGrassScript(commands)
            command = ["cmd.exe", "/C ", GrassUtils.grassScriptFilename()]
        else:
            gisrc =  SextanteUtils.userFolder() + os.sep + "sextante.gisrc"
            os.putenv("GISRC", gisrc)
            os.putenv("GRASS_MESSAGE_FORMAT", "gui")
            os.putenv("GRASS_BATCH_JOB", GrassUtils.grassBatchJobFilename())
            GrassUtils.createGrassBatchJobFileFromGrassCommands(commands)
            os.chmod(GrassUtils.grassBatchJobFilename(), stat.S_IEXEC |
stat.S_IREAD | stat.S_IWRITE)
            *if SextanteUtils.isMac():          
                command =
"/Applications/GRASS-6.4.app/Contents/MacOS/grass.sh " +
GrassUtils.grassMapsetFolder() + "/user"
            else:
                command = "grass64 " + GrassUtils.grassMapsetFolder() +
"/user"*
        loglines = []
        loglines.append("GRASS execution console output")
        proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE,stderr=subprocess.STDOUT,
universal_newlines=True).stdout
.....

submitted: http://hub.qgis.org/issues/6029 http://hub.qgis.org/issues/6029 

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Sextante-on-Mac-OS-X-a-working-solution-for-running-GRASS-commands-tp4987421p4989157.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.



More information about the Qgis-user mailing list