[GRASS-user] r.shade python issues

Gareth Grewcock garethgrewcock at gmail.com
Tue May 24 02:36:07 PDT 2016


Again - thanks for all the help so far, it is much appreciated.

Laurent - I ran the read2_command and it returned the following:

*Traceback (most recent call last):*
*  File "<string>", line 254, in run_nodebug*
*  File
"C:\Users\ggrewcock\Dropbox\PythonScripts\gmt\grass-interface-v2.py", line
85, in <module>*
*    grass.read2_command('r.shade',
shade='hillshade_output_python',color='dem_slope',
 output='shaded_raster_hillshade_map', brighten='25', overwrite=True)*
*AttributeError: 'module' object has no attribute 'read2_command'*

Moritz - I have managed to get r.shade to run in the UI by creating the
module object however, when I run through the script I get a parsing error.
Is this because python env variables are all 'buried' within the ArcGIS
folder?

Traceback (most recent call last):
  File "<string>", line 254, in run_nodebug
  File "<module1>", line 3, in <module>
  File
"C:\OSGEO4~1\apps\grass\grass-7.0.3\etc\python\grass\pygrass\modules\interface\module.py",
line 471, in __init__
    tree = fromstring(self.xml)
  File "C:\Python27\ArcGIS10.4\Lib\xml\etree\ElementTree.py", line 1301, in
XML
    return parser.close()
  File "C:\Python27\ArcGIS10.4\Lib\xml\etree\ElementTree.py", line 1654, in
close
    self._raiseerror(v)
  File "C:\Python27\ArcGIS10.4\Lib\xml\etree\ElementTree.py", line 1506, in
_raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Cheers,
Gareth

On Mon, May 23, 2016 at 6:26 PM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:

> On 23/05/16 15:01, Gareth Grewcock wrote:
>
>> Hi Stefan - thanks for getting back to me.
>>
>> I had tried that before but still got issues, this time returning:
>> 'NameError: name 'r' is not defined'
>>
>> /r.shade(shade=aspect, color=elevation, output=elevation_aspect_shaded)/
>> /Traceback (most recent call last):/
>> /  File "<input>", line 1, in <module>/
>> /NameError: name 'r' is not defined/
>> /
>> /
>> Any ideas what might be causing that?
>>
>
>
> If you are using pygrass, you have to create the r.shade module object
> before using it. See [1].
>
> If you are not using pygrass, please give us more information about what
> happens in your script before the call that fails.
>
> Moritz
>
> [1] https://grass.osgeo.org/grass70/manuals/libpython/pygrass_modules.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160524/8fc33fbc/attachment.html>


More information about the grass-user mailing list