[GRASS-user] Python scripts: 'command not found'

Hi,

I'm working in GRASS 6.4RC6 on Ubuntu 10.04 and I'm trying to learn
how to script GRASS using Python.

I have taken the example at
http://grass.osgeo.org/programming6/pythonlib.html that checks if a
vector is 3D and saved it to my home folder. When I try to run it
though, GRASS can't find the file:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > ls *.py
check_3d.py proxy.py
GRASS 6.4.0RC6 (sa_wgs84):~ > check_3d.py
check_3d.py: command not found
----

I also tried placing the script in the GRASS scripts folder using the
name 'v.check3d' and got the following errors:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > v.check3d
bash: /usr/lib/grass64/scripts/v.check3d: Permission denied
GRASS 6.4.0RC6 (sa_wgs84):~ > sudo v.check3d
[sudo] password for hanlie:
sudo: v.check3d: command not found
-----

Can someone perhaps help me?

Thanks
Hanlie

On Thursday 19 of August 2010 15:13:37 Hanlie Pretorius wrote:

I'm working in GRASS 6.4RC6 on Ubuntu 10.04 and I'm trying to learn
how to script GRASS using Python.

I have taken the example at
http://grass.osgeo.org/programming6/pythonlib.html that checks if a
vector is 3D and saved it to my home folder. When I try to run it
though, GRASS can't find the file:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > ls *.py
check_3d.py proxy.py
GRASS 6.4.0RC6 (sa_wgs84):~ > check_3d.py
check_3d.py: command not found
----

Try "python check_3d.py" or copy the script under the "scripts" directory in
your local grass installation (somethin' lke
"/usr/local/grass-6.4.0svn/scripts").

I also tried placing the script in the GRASS scripts folder using the
name 'v.check3d' and got the following errors:

A, ok! You already did that.

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > v.check3d
bash: /usr/lib/grass64/scripts/v.check3d: Permission denied
GRASS 6.4.0RC6 (sa_wgs84):~ > sudo v.check3d
[sudo] password for hanlie:
sudo: v.check3d: command not found
-----

Better not to use sudo (as a general advice). The script needs to be made
executable for your user-name, i.e.:

sudo chown hanlie:hanlie v.check3d

Hope this helps, Nikos

2010/8/19, Nikos Alexandris <nikos.alexandris@felis.uni-freiburg.de>:

Better not to use sudo (as a general advice). The script needs to be made
executable for your user-name, i.e.:

sudo chown hanlie:hanlie v.check3d

Ran 'sudo chown hanlie:hanlie v.check3d' from the
/usr/lib/grass64/scripts directory with no error messages, but GRASS
still gives a permission error:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > v.check3d
bash: /usr/lib/grass64/scripts/v.check3d: Permission denied
-----

On Thursday 19 of August 2010 15:47:13 Hanlie Pretorius wrote:

2010/8/19, Nikos Alexandris <nikos.alexandris@felis.uni-freiburg.de>:
> Better not to use sudo (as a general advice). The script needs to be made
> executable for your user-name, i.e.:
>
> sudo chown hanlie:hanlie v.check3d

Ran 'sudo chown hanlie:hanlie v.check3d' from the
/usr/lib/grass64/scripts directory with no error messages, but GRASS
still gives a permission error:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > v.check3d
bash: /usr/lib/grass64/scripts/v.check3d: Permission denied
-----

Right, that is becasue I was too fast. My bad. To make it executable

sudo chmod ug+x v.check3d

or

sudo chmod a+x v.check3d

(the latter should also be ok I think if the given script does not contain
dangerous commands).

Nikos

In Ubuntu, you can right click on the file and tick the box to make it
executable....
Right Click > Properties > Permissions
Allow executing files as program

Cheers
Sab

2010/8/19, Nikos Alexandris <nikos.alexandris@felis.uni-freiburg.de>:

Better not to use sudo (as a general advice). The script needs to be
made
executable for your user-name, i.e.:

sudo chown hanlie:hanlie v.check3d

Ran 'sudo chown hanlie:hanlie v.check3d' from the
/usr/lib/grass64/scripts directory with no error messages, but GRASS
still gives a permission error:

-----
GRASS 6.4.0RC6 (sa_wgs84):~ > v.check3d
bash: /usr/lib/grass64/scripts/v.check3d: Permission denied
-----
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

2010/8/19, razmjooeis@faunalia.co.uk <razmjooeis@faunalia.co.uk>:

In Ubuntu, you can right click on the file and tick the box to make it
executable....
Right Click > Properties > Permissions
Allow executing files as program

Cheers
Sab

Thanks, tried this and it workedfor the script in the
/usr/lib/grass64/scripts folder.

Hanlie wrote:

Ran 'sudo chown hanlie:hanlie v.check3d' from the
/usr/lib/grass64/scripts directory with no error messages,
but GRASS still gives a permission error:

perhaps it also needs:

sudo chmod a+rx v.check3d /usr/lib/grass64/scripts/v.check3d

?

Hamish