GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Franz Schiller
Hello All

Regarding a message that Hamish sent me a last  week ago, related with:
>FWIW, I try to copy custom stuff into a dir outside the install
>dir which is pointed to by the GRASS_ADDON_PATH environment
>variable, that way I can replace & upgrade grass versions
>without accidentally deleting all my custom scripts.
>see the "variables" help page.

I have added the following 
export GRASS_ADDON_PATH=/usr/local/myproject
in  grass64 (file located in /usr/local/bin)
When I run my function (i.ndvi) in  Command line, in WXPYTHON GUI,  instead of opening my function module, with all tabs, bla bla, an error window appears stating:
Execution failed: 'i.ndvi'

Details: 
Error: 

And in command output Are printed errors regarding that required data for this script was not inserted
RROR: Required parameter <bandnir> not set:
    (raster input map (Near Infrared)).
ERROR: Required parameter <bandred> not set:
    (raster input map (Red)).
ERROR: Required parameter <ndvi> not set:
    (raster output NDVI map).

Do I haRROR: Required parameter <bandnir> not set:
    (raster input map (Near Infrared)).
ERROR: Required parameter <bandred> not set:
    (raster input map (Red)).
ERROR: Required parameter <ndvi> not set:
    (raster output NDVI map).

is it possible to run scripts, by using Module window, that are located in a external folder? 
It seems like g.parser is not recognizing MODULE parameters

Thank you

Kim  (in a typical latin lunch break :) )



_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson
Greetings all

I have exactly the same problem. If I place a script a ADDON_PATH i get the same error but, If I place at Script folder (inside GRASSsvn6.4.0) it's ok

Any ideas of what it might be missing?

 
Franz Schiller wrote:
Hello All

Regarding a message that Hamish sent me a last  week ago, related with:
>FWIW, I try to copy custom stuff into a dir outside the install
>dir which is pointed to by the GRASS_ADDON_PATH environment
>variable, that way I can replace & upgrade grass versions
>without accidentally deleting all my custom scripts.
>see the "variables" help page.

I have added the following 
export GRASS_ADDON_PATH=/usr/local/myproject
in  grass64 (file located in /usr/local/bin)
When I run my function (i.ndvi) in  Command line, in WXPYTHON GUI,  instead of opening my function module, with all tabs, bla bla, an error window appears stating:
Execution failed: 'i.ndvi'

Details: 
Error: 

And in command output Are printed errors regarding that required data for this script was not inserted
RROR: Required parameter <bandnir> not set:
    (raster input map (Near Infrared)).
ERROR: Required parameter <bandred> not set:
    (raster input map (Red)).
ERROR: Required parameter <ndvi> not set:
    (raster output NDVI map).

Do I haRROR: Required parameter <bandnir> not set:
    (raster input map (Near Infrared)).
ERROR: Required parameter <bandred> not set:
    (raster input map (Red)).
ERROR: Required parameter <ndvi> not set:
    (raster output NDVI map).

is it possible to run scripts, by using Module window, that are located in a external folder? 
It seems like g.parser is not recognizing MODULE parameters



 



_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Paul Kelly
In reply to this post by Franz Schiller
On Wed, 3 Feb 2010, Franz Schiller wrote:

> Hello All
>
> Regarding a message that Hamish sent me a last  week ago, related with:
>> FWIW, I try to copy custom stuff into a dir outside the install
>> dir which is pointed to by the GRASS_ADDON_PATH environment
>> variable, that way I can replace & upgrade grass versions
>> without accidentally deleting all my custom scripts.
>> see the "variables" help page.
>
> I have added the following
> export GRASS_ADDON_PATH=/usr/local/myproject
> in  grass64 (file located in /usr/local/bin)

Perhaps you have added it after the call to Init.sh? It needs to be set
before Init.sh is run in order to be picked up.

Even easier though, would be to set it in your .profile file in your home
directory (create it if it's not there) - then it will always be set
whenever you start a new shell and there is no need to edit the GRASS
startup script. If you upgrade to a newer version of GRASS you won't
need to re-edit the startup script either. Or you could just specify it on
the command-line before starting GRASS; something like:
paul@haptimap:~/gis$ GRASS_ADDON_PATH=/usr/local/myproject grass64
should also work.

Best regards

Paul
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Franz Schiller

Perhaps you have added it after the call to Init.sh? It needs to be set before Init.sh is run in order to be picked up.

My grass64 is like this now:
trap "echo 'User break!' ; exit" 2 3 9 15
GRASS_ADDON_PATH=/usr/local/myproj
export GRASS_ADDON_PATH
# Set the GISBASE variable
GISBASE=/usr/local/grass-6.4.0svn
export GISBASE
exec "$GISBASE/etc/Init.sh" "$@"

So it's defined before Init.sh.
If I do  echo "$GRASS_ADDON_PATH it appears in GRASS so it's parsed inside grass.

Regarding your suggestion:
sudo GRASS_ADDON_PATH=/usr/local/myproject grass64 -wxpython
I got the same result. An Error Window and the same command-output error.

Again, I think this might be an error associated with g.parse since he recognize that the script exists but he is not building Form and he is runned automatically when I insert its name in the command line

Regarding your .profile suggestion, what is necessary to be in that .profile file? and where should it be?

Franz


Even easier though, would be to set it in your .profile file in your home directory (create it if it's not there) - then it will always be set whenever you start a new shell and there is no need to edit the GRASS startup script. If you upgrade to a newer version of GRASS you won't need to re-edit the startup script either. Or you could just specify it on the command-line before starting GRASS; something like:
paul@haptimap:~/gis$ GRASS_ADDON_PATH=/usr/local/myproject grass64
should also work.

Best regards

Paul


_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

hamish-2
In reply to this post by Kim Besson
> Franz Schiller wrote:
> I have added the following export
> GRASS_ADDON_PATH=/usr/local/myproject
> in  grass64 (file located
> in /usr/local/bin)When I run my
> function (i.ndvi) in  Command line, in WXPYTHON GUI,
>  instead of opening my function module, with all tabs, bla
> bla, an error window appears stating:
> Execution
> failed: 'i.ndvi'
>
> Details: Error:
> And in command output Are printed
> errors regarding that required data for this script was not
> inserted
> RROR: Required parameter <bandnir> not
> set:    (raster input map (Near
> Infrared)).ERROR: Required
> parameter <bandred> not
> set:    (raster input map
> (Red)).
...

Kim wrote:
> I have exactly the same problem. If I place a script a
> ADDON_PATH i get the same error but, If I place at Script
> folder (inside GRASSsvn6.4.0) it's ok



if running from the msys prompt, try to run it as "g.module --ui", or
just the module name from the Cmd> prompt in the GUI.


I find it strange that about 5 of us are all noticing this in the last
day or two and yet apparently it's been like that forever. Maybe the way
it fails has changed and now we are just getting further than we ever
did before?


Hamish



     
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson
Hello Hamish

My question, and I think Franz's, has nothing to do with msys. We are questioning this in a linux OS system.

Like I said, if I use Cmd> prompt in the GUI, I get an error stating that I should insert required data and prints all commands.

But your suggestion seems to have some effect
beucase CMD> i.ndvi --ui
It opened the module/GUI but it freezes when I run (and it never freezers if it's in Scripts/) and it seems to be putting g.messasges in the command output.
But GRASS has freezed. And when I treied to stop it printed the following error:
(anrr:2019): Gtk-CRITICAL **: gtk_widget_event: assertion
`WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
Traceback (most recent call last):
  File "/usr/local/grass-6.4.0svn/etc/wxpython/gui_modules/g
output.py", line 486, in OnCmdAbort
    self.cmdThread.abort()
  File "/usr/local/grass-6.4.0svn/etc/wxpython/gui_modules/g
output.py", line 108, in abort
    self.requestCmd.abort()
AttributeError: 'CmdThread' object has no attribute
'requestCmd'

Is it suppose to run scripts, from ADDON_PATH, only in the GUI command-line?

if running from the msys prompt, try to run it as "g.module --ui", or
just the module name from the Cmd> prompt in the GUI.


I find it strange that about 5 of us are all noticing this in the last
day or two and yet apparently it's been like that forever. Maybe the way
it fails has changed and now we are just getting further than we ever
did before?


Hamish






_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Glynn Clements

Kim Besson wrote:

> My question, and I think Franz's, has nothing to do with msys. We are
> questioning this in a linux OS system.
>
> Like I said, if I use Cmd> prompt in the GUI, I get an error stating that I
> should insert required data and prints all commands.

The "auto-GUI" feature (i.e. --ui implied when run without arguments)
only works when the program's stdin is a terminal, which isn't the
case for the GUI's command prompt.

Making it behave like a terminal (i.e. making isatty(0) return true in
the child process) is non-trivial[1] on Unix and practically
impossible on Windows.

[1] It's possible via os.openpty(), where available; the documentation
says:

        Availability: some flavors of Unix

<http://docs.python.org/library/os.html#os.openpty>

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson
Greetings all

ok but... I still can't run a script, through a wxpyhon frame, that is the ADDON_PATH. And in this case, $GRASS_ADDDON_PATH is recognized inside GRASS environment.
My question is: is it possible to run a script, located in GRASS_ADDON_PATH, by using a wxpython frame? Because It seems that I'm not the only one...
Or is there a way do debug this in order to sent to the mailing list?

Thank you

Kim

The "auto-GUI" feature (i.e. --ui implied when run without arguments)
only works when the program's stdin is a terminal, which isn't the
case for the GUI's command prompt.

Making it behave like a terminal (i.e. making isatty(0) return true in
the child process) is non-trivial[1] on Unix and practically
impossible on Windows.

[1] It's possible via os.openpty(), where available; the documentation
says:

       Availability: some flavors of Unix

<http://docs.python.org/library/os.html#os.openpty>

-

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson



Greetings all

ok but... I still can't run a script, through a wxpyhon frame, that is the ADDON_PATH. And in this case, $GRASS_ADDDON_PATH is recognized inside GRASS environment.
My question is: is it possible to run a script, located in GRASS_ADDON_PATH, by using a wxpython frame? Because It seems that I'm not the only one...
Or is there a way do debug this in order to sent to the mailing list?

Thank you

Kim

The "auto-GUI" feature (i.e. --ui implied when run without arguments)
only works when the program's stdin is a terminal, which isn't the
case for the GUI's command prompt.

Making it behave like a terminal (i.e. making isatty(0) return true in
the child process) is non-trivial[1] on Unix and practically
impossible on Windows.

[1] It's possible via os.openpty(), where available; the documentation
says:

       Availability: some flavors of Unix

<http://docs.python.org/library/os.html#os.openpty>

-


_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

hamish-2
Kim wrote:
> ok but... I still can't run a script,
> through a wxpyhon frame, that is the ADDON_PATH. And in this
> case, $GRASS_ADDDON_PATH is recognized inside GRASS
> environment.
> My question is: is it possible to run a script,
> located in GRASS_ADDON_PATH, by using a wxpython frame?


In testing the r.out.gmt addon with 6.4/6.5/7 for me it all works fine.
Are you working with a python script or a shell script?


I do see a few bits of weirdness:

tab gets stalled and won't cycle through the elements. shift-tab
doesn't work to go in reverse.

from the command line:
  'g.module opt1=a optb=2 --ui' opens the module GUI window but does
not pre-seed the values you gave it on the command line as it will in
the TclTk module GUI. This is a bit of a problem as some menu items will
e.g. automatically set the non-interactive flag of a module. plus it's
a nice feature if you get half way through composing a command and forget
what the next option is called.


If I try the d.mark addon in 6.4/6.5 when I hit [Run] it works, but then
it never returns. (d.mark is just a wrapper for d.graph) Gotta click
the "x" in the window corner to close it.


> Because It seems that I'm not the only one...
> Or is there a way do debug this in order to sent to
> the mailing list?

I think we're just going to have to replicate it. Can you get it to fail
using any of the standard modules from the grass-addons svn repo?


Hamish



     
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson
I'm working with Shell Scripts on 6.4.

Hamish how/where are you defining your ADDON_PATH? (copy that to an email, maybe I'm doing something wrong)

I think we're just going to have to replicate it. Can you get it to fail
using any of the standard modules from the grass-addons svn repo?


Ok. About the r.out.gmt (I didn't find d.mark).
If I placed in GRASSsvn6.4.0 scripts folder the GUI opens when I type: r.out.gmt in command output
But If I place in my personal scripts folder I get:
ERROR: Required parameter <input> not set:
    (Name of input raster map).
Description:
 Exports a GRASS raster map into a GMT grid file and color
table
Usage:
 r.out.gmt [-p] input=string [output=string] [--verbose]
[--quiet]
Flags:
  -p   Display suggested GMT PostScript creation commands
 --v   Verbose module output
 --q   Quiet module output
Parameters:
   input   Name of input raster map
  output   Base name of output files (taken from input map
if not given)

Which is the debug for that function.
If I insert r.out.gmt -p input=aspect all GUI freezes.

I think it has something to do with WXPYTHON and scripts outside GRASSsvn6.4.0 folder. WHat do you think?

Thank you
Kim



_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

hamish-2
yeah, this is quite bad. opened as bug #928.


Kim Besson wrote:
> I'm working with Shell Scripts on 6.4.

ok, well covered ground then.


> Hamish how/where are you defining your ADDON_PATH?

in ~/.bashrc I have:
export GRASS_ADDON_PATH=/usr/local/src/grass/addons


most GRASS_* enviro variables I set in .grass.bashrc, but that one has
to be set before init.sh is run.


> Ok. About the r.out.gmt (I didn't find d.mark).

(grass-addons/display/d.shortcuts/, but r.out.gmt is a better example)

> If I placed in GRASSsvn6.4.0 scripts
> folder the GUI opens when I type: r.out.gmt in command output

wxGUI right?

> But If I place in my personal scripts folder I get:
> ERROR: Required parameter <input> not
> set:    (Name of input raster
> map).Description: Exports a GRASS
> raster map into a GMT grid file and
> colortableUsage:
>  r.out.gmt [-p] input=string [output=string]
> [--verbose][--quiet]Flags:  -p
>   Display suggested GMT PostScript creation
> commands --v   Verbose module
> output --q   Quiet module output
> Parameters:   input   Name of input
> raster map  output   Base name of output files
> (taken from input mapif not given)
>
> Which is the debug for that function.

"r.out.gmt" alone does that because it thinks it is running from a
script (because the GUI "script" calls it). If you type "r.out.gmt --ui"
at the wxGUI Cmd> prompt you get the popup option window.

you get this rather unhelpful popup error too:
  __Error in command execution r.out.[snip]__
  Execution failed: 'r.out.gmt'
  Details:
  Error:


> If I insert r.out.gmt -p input=aspect all GUI freezes.

For me it runs and writes the file and says "r.out.gmt complete.", but
it never returns. If I click the [Stop] button to kill it, it does nothing.
Clicking the window dressing "X" to close the window I get the above
unhelpful popup error message again in the wxGUI output tab:

Traceback (most recent call last):
  File "/usr/local/src/grass/svn/releasebranch_6_4/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/goutput.py", line 486, in OnCmdAbort
    self.cmdThread.abort()
  File "/usr/local/src/grass/svn/releasebranch_6_4/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/goutput.py", line 108, in abort
    self.requestCmd.abort()
AttributeError: 'CmdThread' object has no attribute 'requestCmd'


I get pretty much the same thing from the real terminal prompt, except
there the extra --ui is not needed.


> I think it has something to do with WXPYTHON and
> scripts outside GRASSsvn6.4.0 folder. WHat do you think?

yeah, but I don't know why. 6.5+ seems ok.


hmph, it's worse: ALL shell scripts from the command prompt are broken
when GRASS_GUI=tcltk. The error is:
  sh: $GRASS_WISH: command not found


Hamish



     
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS_ADDON_PATH in GRASS6.4 UbuntuOS

Kim Besson
Hello all


in ~/.bashrc I have:
export GRASS_ADDON_PATH=/usr/local/src/grass/addons
 
most GRASS_* enviro variables I set in .grass.bashrc, but that one has
to be set before init.sh is run.

Ok after your email I decided to change my ADDON_PATH To:
/usr/local/src/grass/addons

So my grass64 file (suppose is ~/.bashrc ?) is like this:

#! /bin/sh
trap "echo 'User break!' ; exit" 2 3 9 15

GRASS_ADDON_PATH=/usr/local/src/grass/addons
export GRASS_ADDON_PATH

# Set the GISBASE variable
GISBASE=/usr/local/grass-6.4.0svn
export GISBASE

exec "$GISBASE/etc/Init.sh" "$@"


Sounds good? so everytime I run grass64 in my terminal it runs this file

wxGUI right? 
Yes...

Ok if I insert r.out.gmt at Command line I get the same error-windows and error.
If I insert the command: r.out.gmt input=ndvi00 it seems to work
Exporting raster as integer values (bytes=2)
Writing GMT integer format ID=2
Using the current region settings...
north=228513.000000
south=214975.500000
east=645012.000000
west=629992.500000
r=475
c=527
cat: : No such file or directory
grep: : No such file or directory
r.out.gmt complete. 

If I do r.out.gmt --ui and insert, in GUi frame, the name of the file it processes. But the process doesn't end...

Does anyone had similar problems with defining/using ADDON_PATH in GRASSsvn6.4.0?

Thank you

Kim

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev