[GRASS-user] Running a Pyhton Script on Mac (Mapcalc)
Glynn Clements
glynn at gclements.plus.com
Wed Mar 23 00:22:15 EDT 2011
Johannes Radinger wrote:
> I'd like to run a python script on my GRASS6.5 on MacOS.
>
> I saved a *.py script for testing with following content on my desktop:
> All the needed files (upstream_part, shreve) are existing in the
> location and mapset that is open. Then I tried to execute
> File-->Launch Script and choose it. Then I just get back:
>
> Launching script '/Users/Johannes Radinger/Desktop/mapcalc-test.py'...
> (Tue Mar 22 10:57:15 2011)
> /Users/Johannes Radinger/Desktop/mapcalc-test.py
> (Tue Mar 22 10:57:15 2011) Command finished (0 sec)
>
> and nothing happend and no map was created...
>
> what is wrong with my script?
Does the script have execute permission ("chmod +x ...")?
Does MacOSX have the Python interpreter at /usr/bin/python?
It's common practice for Python scripts to use:
#!/usr/bin/env python
which only requires that "python" is somewhere in $PATH, rather than
assuming a fixed location. The Python scripts in 7.0 use this
mechanism.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list