[GRASS-dev] [GRASS GIS] #1613: r.hazard.flood.py returns a ParseError

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------
Hi,
I'm trying to run the r.hazard.flood.py add-on, but I'm getting the
following error message.
I'm new to GRASS so I apologise if this is an obvious user error.
Many thanks.
-----------------------------
(Mon Mar 12 22:47:16 2012)
r.hazzard.flood.py
C:\Program Files (x86)\GRASS 6.4.2\extrabin\python.exe:
can't open file 'r.hazzard.flood.py': [Errno 2] No such file
or directory
(Mon Mar 12 22:47:17 2012) La commande s'est terminée (0 sec)
Traceback (most recent call last):
   File "C:\Program Files (x86)\GRASS
6.4.2\etc\wxpython\gui_modules\prompt.py", line 1105, in
OnKeyPressed

self.parent.RunCmd(cmd)
   File "C:\Program Files (x86)\GRASS
6.4.2\etc\wxpython\gui_modules\goutput.py", line 523, in
RunCmd

task = menuform.GUI(show = None).ParseCommand(command)
   File "C:\Program Files (x86)\GRASS
6.4.2\etc\wxpython\gui_modules\menuform.py", line 1732, in
ParseCommand

blackList = _blackList)
   File "C:\Program Files (x86)\GRASS
6.4.2\etc\python\grass\script\task.py", line 460, in
parse_interface

tree = etree.fromstring(get_interface_description(name))
   File "C:\Program Files (x86)\GRASS
6.4.2\Python27\lib\xml\etree\ElementTree.py", line 1283, in
XML

return parser.close()
   File "C:\Program Files (x86)\GRASS
6.4.2\Python27\lib\xml\etree\ElementTree.py", line 1636, in
close

self._raiseerror(v)
   File "C:\Program Files (x86)\GRASS
6.4.2\Python27\lib\xml\etree\ElementTree.py", line 1488, in
_raiseerror

raise err
xml.etree.ElementTree
.
ParseError
:
no element found: line 1, column 0

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by madi):

Hi,

you are trying to run 'r.hazzard.flood.py', which is a typo. Correct is
r.hazard.flood.
Nevertheless, if i try to run r.hazzard.flood as you did, i don't get that
error message.
By the way, the module is an add-on written on linux platform, and AFAIK
not yet tested on windows. If you are willing to test it, you are very
welcome.
Could you please try to run it again. And, please, download the r51053. I
just found that the version online was not up-to-date.

Thanks,
madi

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by Ddm):

hi,

Thanks for your help.
Actually, it is not a typo: I do have to launch "r.hazard.flood.py".
Otherwise I get the error message below. It is also hte name that appears
in my list of modules. As a matter of fact, it is the only one that has
the ".py" extension in this list.

I also updated with the latest code but I still get the same error message
(the original one I mean).

---------------
(Tue Mar 13 23:39:10 2012)
r.hazard.flood
C:\Program Files (x86)\GRASS 6.4.2\Python27\lib\site.py:158:
Warning: 'with' will become a reserved keyword in Python 2.6
'import site' failed; use -v for traceback
C:\Program Files (x86)\GRASS
6.4.2\Python27\lib\linecache.py:127: Warning: 'with' will
become a reserved keyword in Python 2.6
Traceback (most recent call last):
   File "C:\Users\David\AppData\Roaming\GRASS6\addons\r.hazar
d.flood.py", line 47, in <module>
     import grass.script as grass
   File "C:\Program Files (x86)\GRASS
6.4.2\etc\python\grass\__init__.py", line 1, in <module>
     import os
   File "C:\Program Files (x86)\GRASS
6.4.2\Python27\lib\os.py", line 754
     bs = b""
            ^
SyntaxError: invalid syntax
(Tue Mar 13 23:39:10 2012) La commande s'est terminée (0 sec)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by martinl):

Replying to [comment:2 Ddm]:

> Actually, it is not a typo: I do have to launch "r.hazard.flood.py".
Otherwise I get the error

yeap, the extension is required on MS Windows. Otherwise OS doesn't know
which interpreter to use.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by madi):

Replying to [comment:2 Ddm]:
> hi,
>
> Thanks for your help.
> Actually, it is not a typo: I do have to launch "r.hazard.flood.py".
Otherwise I get the error message below. It is also hte name that appears
in my list of modules. As a matter of fact, it is the only one that has
the ".py" extension in this list.
>
> I also updated with the latest code but I still get the same error
message (the original one I mean).
>
>
> ---------------
> (Tue Mar 13 23:39:10 2012)
> r.hazard.flood
> C:\Program Files (x86)\GRASS 6.4.2\Python27\lib\site.py:158:
> Warning: 'with' will become a reserved keyword in Python 2.6
> 'import site' failed; use -v for traceback
> C:\Program Files (x86)\GRASS
> 6.4.2\Python27\lib\linecache.py:127: Warning: 'with' will
> become a reserved keyword in Python 2.6
> Traceback (most recent call last):
> File "C:\Users\David\AppData\Roaming\GRASS6\addons\r.hazar
> d.flood.py", line 47, in <module>
> import grass.script as grass
> File "C:\Program Files (x86)\GRASS
> 6.4.2\etc\python\grass\__init__.py", line 1, in <module>
> import os
> File "C:\Program Files (x86)\GRASS
> 6.4.2\Python27\lib\os.py", line 754
> bs = b""
> ^
> SyntaxError: invalid syntax
> (Tue Mar 13 23:39:10 2012) La commande s'est terminée (0 sec)

hi,

thanks for feedback. Actually the typo I meant is "hazzard" instead of
"hazard".
I am not able to reproduce the error because i don't have access to
windows machine. Any idea from developers is very appreciated to try to
solve this issue. Thanks for patience.

madi

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by Ddm):

Hi,
Ah OK... sorry for the misunderstanding. :slight_smile:

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
-------------------------------+--------------------------------------------
Reporter: Ddm | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.hazard.flood.py | Platform: MSWindows 7
      Cpu: Unspecified |
-------------------------------+--------------------------------------------

Comment(by madi):

Hi,

please try r51063. If you get the error message: "grass.script can't be
imported." please read
http://grass.osgeo.org/wiki/GRASS_and_Python#Creating_Python_scripts_that_call_GRASS_functionality_from_outside
in order to adjust the paths of grass variables.

Thanks,
madi

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1613: r.hazard.flood.py returns a ParseError
--------------------------+-------------------------------------------------
  Reporter: Ddm | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Resolution: fixed | Keywords: r.hazard.flood.py
  Platform: MSWindows 7 | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by neteler):

  * status: new => closed
  * resolution: => fixed

Comment:

No more response, closing as fixed. Reopen if needed.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1613#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>