Opened 13 years ago

Closed 12 years ago

#1613 closed defect (fixed)

r.hazard.flood.py returns a ParseError

Reported by: Ddm Owned by: grass-dev@…
Priority: normal Milestone: 6.4.3
Component: Raster Version: unspecified
Keywords: r.hazard.flood.py Cc:
CPU: Unspecified Platform: MSWindows 7

Description

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

Change History (7)

comment:1 by madi, 13 years ago

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

comment:2 by Ddm, 13 years ago

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)

in reply to:  2 comment:3 by martinl, 13 years ago

Replying to 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.

in reply to:  2 comment:4 by madi, 13 years ago

Replying to 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

comment:5 by Ddm, 13 years ago

Hi, Ah OK... sorry for the misunderstanding. :-)

comment:6 by madi, 13 years ago

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

comment:7 by neteler, 12 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.