[GRASS-dev] Re: [GRASS-user] Error when importing data in Windows with Python Script

Luis Lisboa luislisboa1975 at gmail.com
Tue Oct 19 11:00:52 EDT 2010


Ok at utils.py at line 21 I placed:
import shlex
and at the bottom of the file (linhe 424) I placed
def split(s):
    return shlex.split(s, posix = (sys.platform != "win32"))

And I still got this error. Did I did something wrong?


On Mon, Oct 18, 2010 at 2:24 PM, Glynn Clements <glynn at gclements.plus.com>wrote:

>
> Luis Lisboa wrote:
>
> > > No, but wxGUI's "command prompt" is using shlex.split(), which mimics
> > > a typical Unix shell:
> > >
> > >        >>> shlex.split(r'C:\Data\L5216065_06520070405_B70.TIF')
> > >        ['C:DataL5216065_06520070405_B70.TIF']
> > >
> > > I suspect that it should have "posix = False" on Windows:
> > >
> > >        >>> shlex.split(r'C:\Data\L5216065_06520070405_B70.TIF', posix =
> > > False)
> > >        ['C:\\Data\\L5216065_06520070405_B70.TIF']
> >
> > About this, What can i do to fix this? Or isn't anything I can do?
>
> I suggest filing a bug report via http://trac.osgeo.org/grass/
>
> In terms of a fix ... in gui_modules/utils.py, add:
>
>        import shlex
>
>        def split(s):
>            return shlex.split(s, posix = (sys.platform != "win32"))
>
> The tricky part is deciding which occurrences of shlex.split() should
> be replaced. It's possible that some of them need to retain the POSIX
> syntax conventions (where a backslash quotes the following character).
> I suspect that those in prompt.py should be changed, but I'm not sure
> about the others.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20101019/650d06ac/attachment.html


More information about the grass-dev mailing list