> > In order for g.parser to work, the file teste.py needs to be in
> > your PATH.
Glynn wrote:
> This is actually a bug in G_parser() and G_gui(). menuform.py is
> being passed the base filename rather than the complete path.
> There isn't any other reason why the script needs to be in the
> path.
I've fixed this in 7.x with r38126. However, menuform.py
still tries to run the script using its basename.
should this be backported? if so, to which branches?
Hamish
Hamish wrote:
> > > In order for g.parser to work, the file teste.py needs to be in
> > > your PATH.
Glynn wrote:
> > This is actually a bug in G_parser() and G_gui(). menuform.py is
> > being passed the base filename rather than the complete path.
> > There isn't any other reason why the script needs to be in the
> > path.
>
> I've fixed this in 7.x with r38126. However, menuform.py
> still tries to run the script using its basename.
should this be backported? if so, to which branches?
It can't be merged directly, but similar changes should probably be
implemented in the other branches. But there isn't much point until
menuform.py is fixed.
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
2009/7/3 Glynn Clements <glynn@gclements.plus.com>:
implemented in the other branches. But there isn't much point until
menuform.py is fixed.
I am not sure what should have been fixed. It's possible to launch a
script which is not in the PATH. The script must be executable, then
wxGUI is started properly.
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Martin Landa wrote:
> implemented in the other branches. But there isn't much point until
> menuform.py is fixed.
I am not sure what should have been fixed. It's possible to launch a
script which is not in the PATH. The script must be executable, then
wxGUI is started properly.
1. Create a script in the current directory, e.g.:
#!/usr/bin/env python
#%Module
#% description: Test script.
#%End
#%option
#% key: option
#% type: string
#% description: An Option
#% required: yes
#%END
import sys
from grass.script import core as grass
def main():
print options['option']
if __name__ == "__main__":
options, flags = grass.parser()
main()
2. Run it with e.g. "./test.py --ui". It invokes g.parser which
invokes menuform.py with the full path to the script.
3. Fill in the option then click on the "Run" button. This results in
an error dialog:
Execution failed: 'test.py option=foo'
Details:
Error: Unable to exectute command: 'test.py option=foo'
If you copy the script to a directory in $PATH, clicking the "Run"
button runs that script. This indicates that menuform.py is executing
the script using its basename, not the full path given as an argument.
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
2009/7/5 Glynn Clements <glynn@gclements.plus.com>:
[...]
If you copy the script to a directory in $PATH, clicking the "Run"
button runs that script. This indicates that menuform.py is executing
the script using its basename, not the full path given as an argument.
OK, should be fixed in r38220 (trunk only).
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa