#1791: gui modeler: cannot load file with r.mapcalc expression containing '&&'
operator
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: modeler | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
I have a model in which I use r.mapcalculator with the '&&' operator:
{{{
Traceback (most recent call last):
File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/gmodeler/frame.py", line
391, in OnModelOpen
self.LoadModelFile(filename)
File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/gmodeler/frame.py", line
821, in LoadModelFile
(filename, e),
TypeError
:
coercing to Unicode: need string or buffer, ParseError found
}}}
Erasing the '&&' in the .gxm file allows to load it, but you then have to
manually enter it again.
Thanks for reminding about this issue. It is actually trivial (at least I
hope that I haven't overlooked something). Should be fixed for trunk in
r58371.
I tested it but it would be better if you test it, too, XML can be tricky.
Replying to [comment:2 wenzeslaus]:
> Thanks for reminding about this issue. It is actually trivial (at least
I hope that I haven't overlooked something). Should be fixed for trunk in
r58371.
>
> I tested it but it would be better if you test it, too, XML can be
tricky.
It works here when you create a new model file. One which already contains
'&&' still cannot be loaded (which is logical as your change concerns
writing the file), but I guess that this cannot be easily solved and that
your solution is good enough. Any existing model files still have to be
handled manually, but as soon as you save them again the issue is solved.
Replying to [comment:3 mlennert]:
>
> It works here when you create a new model file. One which already
contains '&&' still cannot be loaded (which is logical as your change
concerns writing the file), but I guess that this cannot be easily solved
and that your solution is good enough. Any existing model files still have
to be handled manually, but as soon as you save them again the issue is
solved.
>
Yes of course, I forgot to mention. It now writes a well-formed XML and
also reads well-formed XML (as before).
So, if you have existing `.gxm` file you need to load it with error and
than fix the damaged expressions or other parameters, or you can open the
`.gxm` in text editor and replace (probably all) occurrences of `&&` by
`&&`. Doing so, you will create a well-formed XML from your old
XML (e.g. Gedit highlights `&&` as invalid syntax). Example file part: