[GRASS-dev] winGRASS: 'g.gui wxpython' fails when installed in "Program Files"

Markus Neteler neteler at osgeo.org
Mon Jan 18 18:51:29 EST 2010


(separating this from locale-related email exchange)

With winGRASS is installed in "Program Files", g.gui wxpython
bails out with this error:

GRASS 6.4.0svn (demolocation)> g.gui wxpython
wxgui: can't open file 'C:/Program': [Errno 2] No such file or directory

Comments:

On Thu, Jan 14, 2010 at 1:22 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Glynn Clements wrote:
>> > > Even if we continue to use _spawn*, the quoting code can be taken from
>> > > 7.0; see escaped() in lib/gis/spawn.c. The code is actually quite
>> > > tricky, due to the bizarre quoting rules:
>> > >
>> > >        http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
>> >
>> > Would it be possible for you to suggest a patch?
>>
>> I'll look into it.
>
> Copying spawn.c from 7.0 seems to work fine. But it's a significant
> change, so it should be tested as thoroughly as possible.

Could a developer who has the compile train running, please test this?

> Also, fixing
> G_spawn() doesn't help with modules which use system() or popen(); I
> quite recently replaced most of those in 7.0.
>
> BTW: in looking for test cases, I noticed that neither "g.list -f" nor
> "g.mlist -f" work on Windows. E.g.:
>
>    sprintf(lister, "%s/etc/lister/%s", G_gisbase(),
>            list[n].element[0]);
>
>    if (access(lister, 1) == 0) {       /* execute permission? */
>        G_spawn(lister, lister, opt.mapset->answer, NULL);
>        continue;
>    }
>
> Because the path lacks the .exe suffix, the access() call fails.
> G_spawn() itself doesn't need the .exe suffix, but it never gets that
> far.


On Thu, Jan 14, 2010 at 7:41 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
>> > Because the path lacks the .exe suffix, the access() call fails.
>> > G_spawn() itself doesn't need the .exe suffix, but it never gets that
>> > far.
>>
>> Would this be hell?
>>
>> #ifndef __MINGW32__
>>     sprintf(lister, "%s/etc/lister/%s", G_gisbase(),
>> #else
>>     sprintf(lister, "%s/etc/lister.exe/%s", G_gisbase(),
>> #endif
>
> The .exe goes on the end:
>
> #ifndef __MINGW32__
>    sprintf(lister, "%s/etc/lister/%s", G_gisbase(),
> #else
>    sprintf(lister, "%s/etc/lister/%s.exe", G_gisbase(),
> #endif
>
> Except ... this requires that the lister is an executable; there's no
> fundamental reason why it couldn't be a script, other than the
> access() check (well: that, and the fact that G_spawn() etc don't use
> the shell currently).

Is that a +/-0 or a -1 for the second patch?

Markus


More information about the grass-dev mailing list