[GRASS-dev] formatting expressions for r.mapcalc in GRASS6.4.3
glynn at gclements.plus.com
Fri Mar 15 10:09:34 PDT 2013
Markus Neteler wrote:
> > gui/wxpython/core/utils.py has:
> > def split(s):
> > """!Platform spefic shlex.split"""
> > if sys.version_info >= (2, 6):
> > return shlex.split(s, posix = (sys.platform != "win32"))
> > elif sys.platform == "win32":
> > return shlex.split(s.replace('\\', r'\\'))
> > else:
> > return shlex.split(s)
> > However: shlex.split(..., posix=False) will retain any quotes, while
> > posix=True removes them:
> > > shlex.split('a "b c"')
> > ['a', 'b c']
> > > shlex.split('a "b c"', posix=False)
> > ['a', '"b c"']
> > With posix=False, there doesn't appear any way to prevent splitting on
> > whitespace without also adding quotes.
> > From the above code, it appears that posix=False is used on Windows so
> > that backslash characters in filenames are treated as literal
> > backslashes rather than as escape characters. If that's the only
> > reason, then removing the "if" case may suffice.
> I don't know exactly how let our guest test that...
Tell them to modify utils.py as described above, or provide them with
a modified version.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev