Skip to main content
deleted 26 characters in body
Source Link
Martin
  • 1.3k
  • 1
  • 12
  • 23

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m doing wrong?

import os, sys
import subprocess as subp

gisbase = os.environ['GISBASE'] = "C:/GRASS GIS 7"
gisdbase = os.path.join(os.environ['HOME'])
location = "Martin"
mapset   = "PERMANENT"

sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))

import grass.script as grass
import grass.script.setup as gsetup

gsetup.init(gisbase, gisdbase, location, mapset)
grass.run_command("v.hull", input="D:\Python_Test\1.shp", output="D:\Python_Test\5.shp")

It runs up till grass.run_command, but as a result I only get -1073741515 in pythonwin. Once I get this running, I want to combine ArcPy and GRASS tools in one script. Could it have to do something with the fact that I´m using the ArcGIS Python installation (2.6)?

Sorry if this is a stupid question, I´m still a python beginner with not too much programming experience in other languages either.

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m doing wrong?

import os, sys
import subprocess as subp

gisbase = os.environ['GISBASE'] = "C:/GRASS GIS 7"
gisdbase = os.path.join(os.environ['HOME'])
location = "Martin"
mapset   = "PERMANENT"

sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))

import grass.script as grass
import grass.script.setup as gsetup

gsetup.init(gisbase, gisdbase, location, mapset)
grass.run_command("v.hull", input="D:\Python_Test\1.shp", output="D:\Python_Test\5.shp")

It runs up till grass.run_command, but as a result I only get -1073741515 in pythonwin. Once I get this running, I want to combine ArcPy and GRASS tools in one script. Could it have to do something with the fact that I´m using the ArcGIS Python installation (2.6)?

Sorry if this is a stupid question, I´m still a python beginner with not too much programming experience in other languages either.

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m doing wrong?

import os, sys
import subprocess as subp

gisbase = os.environ['GISBASE'] = "C:/GRASS GIS 7"
gisdbase = os.path.join(os.environ['HOME'])
location = "Martin"
mapset   = "PERMANENT"

sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))

import grass.script as grass
import grass.script.setup as gsetup

gsetup.init(gisbase, gisdbase, location, mapset)
grass.run_command("v.hull", input="D:\Python_Test\1.shp", output="D:\Python_Test\5.shp")

It runs up till grass.run_command, but as a result I only get -1073741515 in pythonwin. Once I get this running, I want to combine ArcPy and GRASS tools in one script. Could it have to do something with the fact that I´m using the ArcGIS Python installation (2.6)?

Sorry if this is a stupid question, I´m still a python beginner with not too much programming experience.

Source Link
Martin
  • 1.3k
  • 1
  • 12
  • 23

GRASS Geoprocessing in Python Script

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m doing wrong?

import os, sys
import subprocess as subp

gisbase = os.environ['GISBASE'] = "C:/GRASS GIS 7"
gisdbase = os.path.join(os.environ['HOME'])
location = "Martin"
mapset   = "PERMANENT"

sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))

import grass.script as grass
import grass.script.setup as gsetup

gsetup.init(gisbase, gisdbase, location, mapset)
grass.run_command("v.hull", input="D:\Python_Test\1.shp", output="D:\Python_Test\5.shp")

It runs up till grass.run_command, but as a result I only get -1073741515 in pythonwin. Once I get this running, I want to combine ArcPy and GRASS tools in one script. Could it have to do something with the fact that I´m using the ArcGIS Python installation (2.6)?

Sorry if this is a stupid question, I´m still a python beginner with not too much programming experience in other languages either.