[GRASS-user] Working with GRASS in Python environment
Anna Petrášová
kratochanna at gmail.com
Tue Mar 24 10:41:04 PDT 2015
On Tue, Mar 24, 2015 at 11:48 AM, TongXiaoye <tongcaptaintong at hotmail.com>
wrote:
> Dear there,
> I'm currently using GRASS 7 python shell on Windows 7 processing
> thousands of raster images.
> It's inconvenient to test the code either by copying the code line by line
> or by running it using 'Launch script' from GUI.
>
> Following the code in this link
> http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7_with_existing_location,
> I want to work with GRASS under Python environment.
>
> I reset three parts to my computer's setting:
> *grass7bin_win = r'C:/Program Files (x86)/GRASS GIS 7.0.0/grass70.bat'*
> *location = "MODIS_GUIWAGOU"*
> *mapset = "GUIWAGOU"*
>
> But I got this error:
> Traceback (most recent call last):
> File "F:\PYTHON\PYTHON_GRASS7.py", line 81, in <module>
> for rast in grass.list_strings(type = 'rast'):
> File "C:\Program Files (x86)\GRASS GIS
> 7.0.0\etc\python\grass\script\core.py", line 1110, in list_strings
> mapset=mapset).splitlines():
> File "C:\Program Files (x86)\GRASS GIS
> 7.0.0\etc\python\grass\script\core.py", line 427, in read_command
> return handle_errors(returncode, stdout, args, kwargs)
> File "C:\Program Files (x86)\GRASS GIS
> 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors
> returncode=returncode)
> CalledModuleError: Module run None ['g.list', '--q', '-m', 'type=rast']
> ended with error
> Process ended with non-zero return code -1073741511. See errors in the
> (error) output.
>
It should be type='raster', not type='rast' when calling g.list or its
interface list_strings
Cheers,
Anna
> Do you know what's wrong?
> Thank you for your help in advance!
>
> Best,
> Xiaoye
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150324/61439fe6/attachment-0001.html>
More information about the grass-user
mailing list