[GRASS-dev] Re: [GRASS-windows] No such file or directory

Glynn Clements glynn at gclements.plus.com
Fri Aug 14 21:24:58 EDT 2009


Peter Brooks wrote:

> No, I think it is whitespace...  I'm trying to use the 'cmd >' field
> in the 'GRASS GIS Layer Manager' (the new wxPython GUI).  I guess
> this is what a Windows user would try to do :-)
> 
> I tried adding a space to the folder name (= 'c:\nc external'),
> forward slashes don't help but speech or quote marks do.
> 
> (I think the same thing happens with all r.in commands if they are
> looking for external files - is this to be expected?)

If an option expects a filename, it will typically be passed directly
to open(), fopen() etc. If you supply a plain filename or a relative
path, it will be interpreted relative to the current directory (rather
than e.g. the mapset directory).

If an option value contains whitespace, it needs to be quoted
appropriately for the context in which it occurs.

In a Windows command prompt, you need to put double quotes around the
entire option=value argument.

In bash, you can use single or double quotes around the entire
argument or around the filename, or precede spaces by backslash
characters (also, you need to either use forward slashes as directory
separators or quote backslashes appropriately).

The command prompt in the wxPython GUI uses Python's shlex module (in
POSIX mode), which provides bash-like quoting:

http://docs.python.org/library/shlex.html#parsing-rules

Filenames entered elsewhere in the GUI shouldn't normally need to be
quoted.

Even with correct quoting, some shell scripts may not correctly handle
filenames containing spaces; this is part of the reason why shell
scripts have been replaced with Python scripts in GRASS 7.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list