[GRASS-user] r.viewshed Python Script OSError

Hello,

I am using GRASS 6.4 on Debian. I am trying to make a call to
r.viewshed from Python, but it fails with the following exception:

OSError: [Errno 2] No such file or directory

Any suggestions?

Thank you,
Martin

On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hello,

I am using GRASS 6.4 on Debian. I am trying to make a call to
r.viewshed from Python, but it fails with the following exception:

OSError: [Errno 2] No such file or directory

Any suggestions?

Did you install r.viewshed?

Where is the r.viewshed binary?

Is the location of r.viewshed in the PATH (within GRASS, test with
"echo $PATH")?

Did you execute the python script from within GRASS?

Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn.

Markus M

Hi Markus,

I did install r.viewshed (it is located in ~/.grass6/addons/), and the
full path does appear in $PATH.

I am executing the Python script from outside of GRASS. Is this
normal? I am hoping for some advice on this. The intent is to liberate
some software (naturalcapitalproject.org) from ArcGIS for users on
Windows.

When I start GRASS (in text mode) it says "Welcome to GRASS 6.4.2 (2012)."

Thank you,
Martin

On Sun, May 26, 2013 at 1:27 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hello,

I am using GRASS 6.4 on Debian. I am trying to make a call to
r.viewshed from Python, but it fails with the following exception:

OSError: [Errno 2] No such file or directory

Any suggestions?

Did you install r.viewshed?

Where is the r.viewshed binary?

Is the location of r.viewshed in the PATH (within GRASS, test with
"echo $PATH")?

Did you execute the python script from within GRASS?

Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn.

Markus M

On Tue, May 28, 2013 at 7:09 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hi Markus,

I did install r.viewshed (it is located in ~/.grass6/addons/), and the
full path does appear in $PATH.

I am executing the Python script from outside of GRASS. Is this
normal? I am hoping for some advice on this.

You need to execute the Python script from within GRASS, or set some
environment variables first, see [1]. Within your script, you could
also first use a dummy location, for example the GRASS demolocation,
then create a new location with the projection information in the
raster map to be used as input for r.viewshed, change to that
location, import the raster map, run r.viewshed, export the result.
This is essentially what the SEXTANTE plugin in QGIS is doing.

The intent is to liberate
some software (naturalcapitalproject.org) from ArcGIS for users on
Windows.

Nice!

When I start GRASS (in text mode) it says "Welcome to GRASS 6.4.2 (2012)."

If possible, update to GRASS 6.4.3.

HTH,

Markus M

[1] http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly

Thank you,
Martin

On Sun, May 26, 2013 at 1:27 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hello,

I am using GRASS 6.4 on Debian. I am trying to make a call to
r.viewshed from Python, but it fails with the following exception:

OSError: [Errno 2] No such file or directory

Any suggestions?

Did you install r.viewshed?

Where is the r.viewshed binary?

Is the location of r.viewshed in the PATH (within GRASS, test with
"echo $PATH")?

Did you execute the python script from within GRASS?

Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn.

Markus M

Hi Markus,

Thank you for the link, that is very helpful.

I would prefer to use SEXTANTE over GRASS since it also gives access
to other tools as well, but so far I have had more luck with GRASS. I
will post an update once one of these approaches works.

I've compiled and installed GRASS 6.4.3RC3 from source, but now I'm
having trouble installing the r.viewshed extension.

I'm getting the following error:

make: *** No rule to make target `/usr/local/grass-6.4.3RC3/
lib/libgrass_iostream.6.4.3RC3.a', needed by
`/home/mlacayo/grass/newLocation/PERMANENT/.tmp/ncp-
cloos/10168.0/r.viewshed/bin/r.viewshed'. Stop.
ERROR: Compilation failed, sorry. Please check above error messages.
(Wed May 29 11:53:36 2013) Command finished (7 sec)

As a test I tried installing g.md5sum and r.area, which installed
without problems.

Any suggestions?

-Martin

On Tue, May 28, 2013 at 11:20 AM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Tue, May 28, 2013 at 7:09 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hi Markus,

I did install r.viewshed (it is located in ~/.grass6/addons/), and the
full path does appear in $PATH.

I am executing the Python script from outside of GRASS. Is this
normal? I am hoping for some advice on this.

You need to execute the Python script from within GRASS, or set some
environment variables first, see [1]. Within your script, you could
also first use a dummy location, for example the GRASS demolocation,
then create a new location with the projection information in the
raster map to be used as input for r.viewshed, change to that
location, import the raster map, run r.viewshed, export the result.
This is essentially what the SEXTANTE plugin in QGIS is doing.

The intent is to liberate
some software (naturalcapitalproject.org) from ArcGIS for users on
Windows.

Nice!

When I start GRASS (in text mode) it says "Welcome to GRASS 6.4.2 (2012)."

If possible, update to GRASS 6.4.3.

HTH,

Markus M

[1] http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly

Thank you,
Martin

On Sun, May 26, 2013 at 1:27 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo <mlacayo@stanford.edu> wrote:

Hello,

I am using GRASS 6.4 on Debian. I am trying to make a call to
r.viewshed from Python, but it fails with the following exception:

OSError: [Errno 2] No such file or directory

Any suggestions?

Did you install r.viewshed?

Where is the r.viewshed binary?

Is the location of r.viewshed in the PATH (within GRASS, test with
"echo $PATH")?

Did you execute the python script from within GRASS?

Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn.

Markus M