I am trying to run Python code for Grass GIS from this site
Specifically, here is my code:
## Import libraries needed to call GRASS using Python
import grass.script as grass
from grass.script import core as grass
import grass.script as grass
grass.run_command('g.region', raster='elevation')
But I am getting the following error:
---------------------------------------------------------------------------
CalledModuleError Traceback (most recent call last)
<ipython-input-13-2ea69f70ebcb> in <module>()
7 from grass.script import core as grass
8 import grass.script as grass
----> 9 grass.run_command('g.region', raster='elevation')
C:\Program Files\GRASS GIS 7.5.svn\etc\python\grass\script\core.pyc in run_command(*args, **kwargs)
419 else:
420 returncode = ps.wait()
--> 421 return handle_errors(returncode, returncode, args, kwargs)
422
423
C:\Program Files\GRASS GIS 7.5.svn\etc\python\grass\script\core.pyc in handle_errors(returncode, result, args, kwargs)
330 args = make_command(*args, **kwargs)
331 raise CalledModuleError(module=None, code=repr(args),
--> 332 returncode=returncode)
333
334 def start_command(prog, flags=b"", overwrite=False, quiet=False,
CalledModuleError: Module run None ['g.region', 'raster=elevation'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.