[GRASS-user] grass-user Digest, Vol 107, Issue 9

Anna Petrášová kratochanna at gmail.com
Fri Mar 6 18:46:16 PST 2015


On Fri, Mar 6, 2015 at 8:45 PM, Rob Parsons <jrobparsons at gmail.com> wrote:

> I converted the interactive script at the top of this page,
>
> http://grass.osgeo.org/grass70/manuals/libpython/script.html
>
> to a batch script.
>
> I understand what the script is trying to do. When I File -> "Launch
> script" from the "Layer Manager" GUI, the script appears to run to
> completion, but, this message is displayed on the "Command console":
>
>  "ERROR: Unable to create file
> <C:\grassdata/North_Carolina/user1/.tmp/unknown/4808.1>"
>
> I have traced it to this statement in the script:
>
> map2d_2.read("map2d_1")
>
> The file was indeed created.
>
> C:\grassdata\North_Carolina\user1\.tmp\unknown>dir
>  Volume in drive C is OS
>  Volume Serial Number is C4D0-A091
>
>  Directory of C:\grassdata\North_Carolina\user1\.tmp\unknown
>
> 2015-03-06  08:25 PM    <DIR>          .
> 2015-03-06  08:25 PM    <DIR>          ..
> 2015-03-06  08:25 PM               192 4808.0
> 2015-03-06  08:25 PM               192 4808.1
> 2015-03-06  08:25 PM               576 4808.2
>                3 File(s)            960 bytes
>                2 Dir(s)  22,857,420,800 bytes free
>
> C:\grassdata\North_Carolina\user1\.tmp\unknown>
>
> The script prints out the 2D and 3D arrays.
>
> The 2D rasters (map2d_1 and map2d_2) are written to the 'user1' mapset but
> not the 3D rasters (map3d_1 and map3d_2).
>
> Has anyone successfully run this example?
>

It seems it got broken very recently, I created a ticket for that (
http://trac.osgeo.org/grass/ticket/2616). Do you need to use this library?
There is also newer library PyGRASS (
http://grass.osgeo.org/grass70/manuals/libpython/pygrass_raster.html), it
has more capabilities, so you might want to use that anyway. Perhaps if you
would share what is your usecase, people may have some advice.

Anna

>
>
> Rob Parsons
> Raleigh NC
>
>
>
>
>
> On Thu, Mar 5, 2015 at 10:42 PM, Rob Parsons <jrobparsons at gmail.com>
> wrote:
>
>> Yes.
>> I do get the "add the script path to GRASS_ADDON_PATH" prompt. After I
>> say 'yes' to the prompt, the script runs successfully.
>> Thanks!
>>
>>
>> On Thu, Mar 5, 2015 at 1:14 PM, <grass-user-request at lists.osgeo.org>
>> wrote:
>>
>>> Send grass-user mailing list submissions to
>>>         grass-user at lists.osgeo.org
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>         http://lists.osgeo.org/mailman/listinfo/grass-user
>>> or, via email, send a message with subject or body 'help' to
>>>         grass-user-request at lists.osgeo.org
>>>
>>> You can reach the person managing the list at
>>>         grass-user-owner at lists.osgeo.org
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of grass-user digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>>    1. Re: grass-user Digest, Vol 107, Issue 2 (Anna Petr??ov?)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Thu, 5 Mar 2015 13:14:05 -0500
>>> From: Anna Petr??ov? <kratochanna at gmail.com>
>>> To: Rob Parsons <jrobparsons at gmail.com>
>>> Cc: GRASS user list <grass-user at lists.osgeo.org>
>>> Subject: Re: [GRASS-user] grass-user Digest, Vol 107, Issue 2
>>> Message-ID:
>>>         <CAE0EDEro0wnTAaLkgmwsvpZcUckXvXmzBUMcOv4J5qwW=
>>> qRZPg at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> On Wed, Mar 4, 2015 at 10:09 PM, Rob Parsons <jrobparsons at gmail.com>
>>> wrote:
>>>
>>> > Thanks for the direction!
>>> >
>>> > I have successfully worked through the examples on
>>> > http://grass.osgeo.org/grass70/manuals/libpython/script_intro.html
>>> except
>>> > for the last one about adding a module interface to a script. I copied
>>> the
>>> > code into a python file named module_interface.py. After I File->
>>> "Launch
>>> > script" and select module_interface.py, the module GUI pops up and
>>> prompts
>>> > for the raster inputs and output. But, after clicking on "Run", the
>>> script
>>> > reports the following message:
>>> >
>>> >
>>> Before the module dialog opens, you should get a dialog asking to add the
>>> script path to GRASS_ADDON_PATH. If you do it, you should be able to run
>>> the script. Did you get this dialog?
>>>
>>> Anna
>>>
>>> (Wed Mar 04 21:55:29
>>> > 2015)
>>> > module_interface araster=el_D782_6m at PERMANENT
>>> braster=el_D783_6m at PERMANENT
>>> > output=el_r_6m
>>> > 'module_interface' is not recognized as an internal or
>>> > external command,
>>> > operable program or batch file.
>>> > (Wed Mar 04 21:55:29 2015) Command finished (0
>>> > sec)
>>> >
>>> > Anyone seen this message?
>>> >
>>> > Rob Parsons
>>> > Raleigh NC
>>> >
>>> >
>>> >
>>> > On Sun, Mar 1, 2015 at 8:13 PM, <grass-user-request at lists.osgeo.org>
>>> > wrote:
>>> >
>>> >> Send grass-user mailing list submissions to
>>> >>         grass-user at lists.osgeo.org
>>> >>
>>> >> To subscribe or unsubscribe via the World Wide Web, visit
>>> >>         http://lists.osgeo.org/mailman/listinfo/grass-user
>>> >> or, via email, send a message with subject or body 'help' to
>>> >>         grass-user-request at lists.osgeo.org
>>> >>
>>> >> You can reach the person managing the list at
>>> >>         grass-user-owner at lists.osgeo.org
>>> >>
>>> >> When replying, please edit your Subject line so it is more specific
>>> >> than "Re: Contents of grass-user digest..."
>>> >>
>>> >>
>>> >> Today's Topics:
>>> >>
>>> >>    1. GRASS 7.0 Running Scripts (.\GRASS GIS 7.0.0\scripts)
>>> >>       (Rob Parsons)
>>> >>    2. Re: GRASS 7.0 Running Scripts (.\GRASS GIS        7.0.0\scripts)
>>> >>       (Vaclav Petras)
>>> >>
>>> >>
>>> >> ----------------------------------------------------------------------
>>> >>
>>> >> Message: 1
>>> >> Date: Sun, 1 Mar 2015 19:37:59 -0500
>>> >> From: Rob Parsons <jrobparsons at gmail.com>
>>> >> To: grass-user at lists.osgeo.org
>>> >> Subject: [GRASS-user] GRASS 7.0 Running Scripts (.\GRASS GIS
>>> >>         7.0.0\scripts)
>>> >> Message-ID:
>>> >>         <
>>> >> CAFvPsPBH1xVpEgff15hxknY0qeeMUeehP9bucV4FB9ZgQ_2+cg at mail.gmail.com>
>>> >> Content-Type: text/plain; charset="utf-8"
>>> >>
>>> >> Hello,
>>> >>
>>> >> How do I run scripts located in C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\scripts?
>>> >>
>>> >> I am learning GRASS 7.0.0 on Windows 7 by converting some GRASS 6.4
>>> shell
>>> >> scripts to GRASS 7 Python scripts (import grass.script as grass) and
>>> GRASS
>>> >> 7 PyGRASS scripts (from grass.pygrass.modules import Module).
>>> >>
>>> >> My installation is working fine. I can manually run the commands
>>> (from a
>>> >> shell script) in the "Command console" window of the "Layer Manager".
>>> For
>>> >> example, I can enter "g.region swwake_30m -p" in the "Command prompt"
>>> area
>>> >> and get the following results:
>>> >>
>>> >>
>>> >> Sun Mar 01 12:32:30
>>> >> 2015)
>>> >> g.region swwake_30m
>>> >> -p
>>> >> projection: 99 (Lambert Conformal Conic)
>>> >> zone:       0
>>> >> datum:      nad83
>>> >> ellipsoid:  a=6378137 es=0.006694380022900787
>>> >> north:      228500
>>> >> south:      215000
>>> >> west:       630000
>>> >> east:       645000
>>> >> nsres:      30
>>> >> ewres:      30
>>> >> rows:       450
>>> >> cols:       500
>>> >> cells:      225000
>>> >> (Sun Mar 01 12:32:31 2015) Command finished (0
>>> >> sec)
>>> >>
>>> >> I am using the "Pythonwin" IDE to develop the scripts (C:\Program
>>> Files
>>> >> (x86)\GRASS GIS
>>> 7.0.0\Python27\lib\site-packages\pythonwin\Pythonwin.exe).
>>> >> In the "GRASS GIS 7.0.0 GUI" Command Prompt window I type "pythonwin"
>>> and
>>> >> the IDE starts up.
>>> >>
>>> >> I have spent several days trying to understand how to create GRASS
>>> Python
>>> >> scripts and GRASS PyGRASS scripts from the online documentation(
>>> >> http://grasswiki.osgeo.org/wiki/GRASS_and_Python) and by studying the
>>> >> script samples (C:\Program Files (x86)\GRASS GIS 7.0.0\scripts). I
>>> have
>>> >> not
>>> >> been successful in getting example code to run but I am still working
>>> >> through the documentation.
>>> >>
>>> >> But, I should be able to run scripts located in C:\Program Files
>>> >> (x86)\GRASS GIS 7.0.0\scripts.
>>> >>
>>> >> Correct?
>>> >>
>>> >> 1. If I open .\scripts\d.what.rast.py in the Pythonwin IDE and try
>>> to run
>>> >> it, I get this output:
>>> >>
>>> >> OSError error(9): The handle is invalid
>>> >> Traceback (most recent call last):
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >>
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> line 325, in RunScript
>>> >>     exec codeObject in __main__.__dict__
>>> >>   File
>>> >>
>>> >>
>>> "C:\Users\Rob\Documents\grassscripts\pygrass\make_raster_using_mapcalc.py",
>>> >> line 8, in <module>
>>> >>     g.message("Filter elevation map by a threshold...")
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\etc\python\grass\pygrass\modules\shortcuts.py", line 46, in
>>> >> __getattr__
>>> >>     return self.cls('%s.%s' % (self.prefix, name.replace('_', '.')))
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\etc\python\grass\pygrass\modules\interface\module.py", line
>>> 498, in
>>> >> __init__
>>> >>     raise GrassError(str_err % self.name)
>>> >> GrassError: Error running: `g.message --interface-description`.
>>> >> Traceback (most recent call last):
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >>
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> line 325, in RunScript
>>> >>     exec codeObject in __main__.__dict__
>>> >>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\d.what.rast.py
>>> ",
>>> >> line 45, in <module>
>>> >>     main()
>>> >>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\d.what.rast.py
>>> ",
>>> >> line 30, in main
>>> >>     options, flags = gcore.parser()
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\etc\python\grass\script\core.py", line 680, in parser
>>> >>     p = subprocess.Popen([prog, '-n'] + argv, stdout=subprocess.PIPE)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 703, in __init__
>>> >>     errread, errwrite) = self._get_handles(stdin, stdout, stderr)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 839, in _get_handles
>>> >>     p2cread = self._make_inheritable(p2cread)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 878, in _make_inheritable
>>> >>     _subprocess.DUPLICATE_SAME_ACCESS)
>>> >> WindowsError: [Error 6] The handle is invalid
>>> >> Traceback (most recent call last):
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >>
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> line 325, in RunScript
>>> >>     exec codeObject in __main__.__dict__
>>> >>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\d.what.rast.py
>>> ",
>>> >> line 45, in <module>
>>> >>     main()
>>> >>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\d.what.rast.py
>>> ",
>>> >> line 30, in main
>>> >>     options, flags = gcore.parser()
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\etc\python\grass\script\core.py", line 680, in parser
>>> >>     p = subprocess.Popen([prog, '-n'] + argv, stdout=subprocess.PIPE)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 703, in __init__
>>> >>     errread, errwrite) = self._get_handles(stdin, stdout, stderr)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 839, in _get_handles
>>> >>     p2cread = self._make_inheritable(p2cread)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\subprocess.py",
>>> >> line 878, in _make_inheritable
>>> >>     _subprocess.DUPLICATE_SAME_ACCESS)
>>> >> WindowsError: [Error 6] The handle is invalid
>>> >> >>>
>>> >>
>>> >> 2. If I go to the "Python shell" tab on the "Layer Manager" and do
>>> File ->
>>> >> Launch Script and browse to .\scripts\d.what.rast.py, I get this
>>> output:
>>> >>
>>> >> (Sun Mar 01 12:32:31 2015) Command finished (0
>>> >> sec)
>>> >> Launching script 'C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> >> d.what.rast.py'...
>>> >> Traceback (most recent call last):
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\gui\wxpython\gui_core\forms.py", line 718, in OnRun
>>> >>
>>> >> gcmd.Command(cmd)
>>> >>   File "C:\Program Files (x86)\GRASS GIS
>>> >> 7.0.0\gui\wxpython\core\gcmd.py", line 397, in __init__
>>> >>
>>> >> _("Error: ") + self.__GetError()))
>>> >> core.gcmd
>>> >> .
>>> >> GException
>>> >> :
>>> >> Execution failed: 'd.what.rast map=elevation'
>>> >> Details:
>>> >> Error:
>>> >>
>>> >> Any ideas on what might be going on here?
>>> >>
>>> >> Rob Parsons
>>> >> Raleigh NC
>>> >> -------------- next part --------------
>>> >> An HTML attachment was scrubbed...
>>> >> URL: <
>>> >>
>>> http://lists.osgeo.org/pipermail/grass-user/attachments/20150301/b41b2959/attachment-0001.html
>>> >> >
>>> >>
>>> >> ------------------------------
>>> >>
>>> >> Message: 2
>>> >> Date: Sun, 1 Mar 2015 20:12:57 -0500
>>> >> From: Vaclav Petras <wenzeslaus at gmail.com>
>>> >> To: Rob Parsons <jrobparsons at gmail.com>
>>> >> Cc: GRASS user list <grass-user at lists.osgeo.org>
>>> >> Subject: Re: [GRASS-user] GRASS 7.0 Running Scripts (.\GRASS GIS
>>> >>         7.0.0\scripts)
>>> >> Message-ID:
>>> >>         <CABo5uVt7hq0QnHYqzV5O949h3URGxFOAjHNLxiMx=
>>> >> V5rSK_wRw at mail.gmail.com>
>>> >> Content-Type: text/plain; charset="utf-8"
>>> >>
>>> >> On Sun, Mar 1, 2015 at 7:37 PM, Rob Parsons <jrobparsons at gmail.com>
>>> >> wrote:
>>> >>
>>> >> > Hello,
>>> >> >
>>> >> > How do I run scripts located in C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\scripts?
>>> >> >
>>> >> > I am learning GRASS 7.0.0 on Windows 7 by converting some GRASS 6.4
>>> >> shell
>>> >> > scripts to GRASS 7 Python scripts (import grass.script as grass) and
>>> >> GRASS
>>> >> > 7 PyGRASS scripts (from grass.pygrass.modules import Module).
>>> >> >
>>> >> > My installation is working fine. I can manually run the commands
>>> (from a
>>> >> > shell script) in the "Command console" window of the "Layer
>>> Manager".
>>> >> For
>>> >> > example, I can enter "g.region swwake_30m -p" in the "Command
>>> prompt"
>>> >> area
>>> >> > and get the following results:
>>> >> >
>>> >> >
>>> >> > Sun Mar 01 12:32:30
>>> >> > 2015)
>>> >> > g.region swwake_30m
>>> >> > -p
>>> >> > projection: 99 (Lambert Conformal Conic)
>>> >> > zone:       0
>>> >> > datum:      nad83
>>> >> > ellipsoid:  a=6378137 es=0.006694380022900787
>>> >> > north:      228500
>>> >> > south:      215000
>>> >> > west:       630000
>>> >> > east:       645000
>>> >> > nsres:      30
>>> >> > ewres:      30
>>> >> > rows:       450
>>> >> > cols:       500
>>> >> > cells:      225000
>>> >> > (Sun Mar 01 12:32:31 2015) Command finished (0
>>> >> > sec)
>>> >> >
>>> >> > I am using the "Pythonwin" IDE to develop the scripts (C:\Program
>>> Files
>>> >> > (x86)\GRASS GIS
>>> >> 7.0.0\Python27\lib\site-packages\pythonwin\Pythonwin.exe).
>>> >> > In the "GRASS GIS 7.0.0 GUI" Command Prompt window I type
>>> "pythonwin"
>>> >> and
>>> >> > the IDE starts up.
>>> >> >
>>> >> > I have spent several days trying to understand how to create GRASS
>>> >> Python
>>> >> > scripts and GRASS PyGRASS scripts from the online documentation(
>>> >> > http://grasswiki.osgeo.org/wiki/GRASS_and_Python) and by studying
>>> the
>>> >> > script samples (C:\Program Files (x86)\GRASS GIS 7.0.0\scripts). I
>>> have
>>> >> not
>>> >> > been successful in getting example code to run but I am still
>>> working
>>> >> > through the documentation.
>>> >> >
>>> >> > Please try the example from:
>>> >>
>>> >> http://grass.osgeo.org/grass70/manuals/libpython/script_intro.html
>>> >>
>>> >> I linked this page from documentation as well as the other Python wiki
>>> >> page
>>> >> from the GRASS and Python page:
>>> >>
>>> >> http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library
>>> >>
>>> >> Note that GRASS scripts by default cannot run from outside GRASS GIS
>>> >> session (environment). This is probably not emphasized enough in the
>>> >> documentation.
>>> >>
>>> >> But, I should be able to run scripts located in C:\Program Files
>>> >> > (x86)\GRASS GIS 7.0.0\scripts.
>>> >> >
>>> >> > Correct?
>>> >> >
>>> >> > Correct but can you please try some other module than a d.* module,
>>> e.g.
>>> >> r.out.xyz? d.* commands are somehow special (although in this case it
>>> >> probably doesn't matter).
>>> >>
>>> >>
>>> >> > 1. If I open .\scripts\d.what.rast.py in the Pythonwin IDE and try
>>> to
>>> >> run
>>> >> > it, I get this output:
>>> >> >
>>> >> > OSError error(9): The handle is invalid
>>> >> > Traceback (most recent call last):
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> >
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> > line 325, in RunScript
>>> >> >     exec codeObject in __main__.__dict__
>>> >> >   File
>>> >> >
>>> >>
>>> "C:\Users\Rob\Documents\grassscripts\pygrass\make_raster_using_mapcalc.py",
>>> >> > line 8, in <module>
>>> >> >     g.message("Filter elevation map by a threshold...")
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\etc\python\grass\pygrass\modules\shortcuts.py", line 46, in
>>> >> > __getattr__
>>> >> >     return self.cls('%s.%s' % (self.prefix, name.replace('_', '.')))
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\etc\python\grass\pygrass\modules\interface\module.py", line
>>> 498,
>>> >> in
>>> >> > __init__
>>> >> >     raise GrassError(str_err % self.name)
>>> >> > GrassError: Error running: `g.message --interface-description`.
>>> >> > Traceback (most recent call last):
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> >
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> > line 325, in RunScript
>>> >> >     exec codeObject in __main__.__dict__
>>> >> >   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> d.what.rast.py",
>>> >> > line 45, in <module>
>>> >> >     main()
>>> >> >   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> d.what.rast.py",
>>> >> > line 30, in main
>>> >> >     options, flags = gcore.parser()
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\etc\python\grass\script\core.py", line 680, in parser
>>> >> >     p = subprocess.Popen([prog, '-n'] + argv,
>>> stdout=subprocess.PIPE)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 703, in __init__
>>> >> >     errread, errwrite) = self._get_handles(stdin, stdout, stderr)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 839, in _get_handles
>>> >> >     p2cread = self._make_inheritable(p2cread)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 878, in _make_inheritable
>>> >> >     _subprocess.DUPLICATE_SAME_ACCESS)
>>> >> > WindowsError: [Error 6] The handle is invalid
>>> >> > Traceback (most recent call last):
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> >
>>> >>
>>> 7.0.0\Python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> >> > line 325, in RunScript
>>> >> >     exec codeObject in __main__.__dict__
>>> >> >   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> d.what.rast.py",
>>> >> > line 45, in <module>
>>> >> >     main()
>>> >> >   File "C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> d.what.rast.py",
>>> >> > line 30, in main
>>> >> >     options, flags = gcore.parser()
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\etc\python\grass\script\core.py", line 680, in parser
>>> >> >     p = subprocess.Popen([prog, '-n'] + argv,
>>> stdout=subprocess.PIPE)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 703, in __init__
>>> >> >     errread, errwrite) = self._get_handles(stdin, stdout, stderr)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 839, in _get_handles
>>> >> >     p2cread = self._make_inheritable(p2cread)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\Python27\lib\subprocess.py", line 878, in _make_inheritable
>>> >> >     _subprocess.DUPLICATE_SAME_ACCESS)
>>> >> > WindowsError: [Error 6] The handle is invalid
>>> >> > >>>
>>> >> >
>>> >> >
>>> >>
>>> >> This might be somehow related to bug in Python itself:
>>> >>
>>> >> http://bugs.python.org/issue3905
>>> >>
>>> >> However, please focus on running the scripts for GRASS GIS from GRASS
>>> >> session. The easiest way how to do that on MS Windows is to write the
>>> >> script and then to start it from GUI (File > Run script) or from
>>> Python
>>> >> shell tab in the GUI.
>>> >>
>>> >> It is possible to run scripts which are using GRASS modules from
>>> outside
>>> >> of
>>> >> GRASS session but it requires you to set up the GRASS environment
>>> >> yourself.
>>> >> This is possible but it has some challenges. On the other hand, if you
>>> >> write your script in the way that it runs (only) in a GRASS session
>>> you
>>> >> can
>>> >> use GRASS features for automatic building of interface and thus
>>> create a
>>> >> true GRASS module.
>>> >>
>>> >>
>>> >> > 2. If I go to the "Python shell" tab on the "Layer Manager" and do
>>> File
>>> >> ->
>>> >> > Launch Script and browse to .\scripts\d.what.rast.py, I get this
>>> >> output:
>>> >> >
>>> >> > (Sun Mar 01 12:32:31 2015) Command finished (0
>>> >> > sec)
>>> >> > Launching script 'C:\Program Files (x86)\GRASS GIS 7.0.0\scripts\
>>> >> > d.what.rast.py'...
>>> >> > Traceback (most recent call last):
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\gui\wxpython\gui_core\forms.py", line 718, in OnRun
>>> >> >
>>> >> > gcmd.Command(cmd)
>>> >> >   File "C:\Program Files (x86)\GRASS GIS
>>> >> > 7.0.0\gui\wxpython\core\gcmd.py", line 397, in __init__
>>> >> >
>>> >> > _("Error: ") + self.__GetError()))
>>> >> > core.gcmd
>>> >> > .
>>> >> > GException
>>> >> > :
>>> >> > Execution failed: 'd.what.rast map=elevation'
>>> >> > Details:
>>> >> > Error:
>>> >> >
>>> >> > The error message seems to be incomplete but in any case, please try
>>> >> with
>>> >> r.out.xyz script and the example script from:
>>> >>
>>> >> http://grass.osgeo.org/grass70/manuals/libpython/script_intro.html
>>> >>
>>> >> Vaclav
>>> >>
>>> >>
>>> >> > Any ideas on what might be going on here?
>>> >> >
>>> >> > Rob Parsons
>>> >> > Raleigh NC
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > grass-user mailing list
>>> >> > grass-user at lists.osgeo.org
>>> >> > http://lists.osgeo.org/mailman/listinfo/grass-user
>>> >> >
>>> >> -------------- next part --------------
>>> >> An HTML attachment was scrubbed...
>>> >> URL: <
>>> >>
>>> http://lists.osgeo.org/pipermail/grass-user/attachments/20150301/6ff05a0b/attachment.html
>>> >> >
>>> >>
>>> >> ------------------------------
>>> >>
>>> >> _______________________________________________
>>> >> grass-user mailing list
>>> >> grass-user at lists.osgeo.org
>>> >> http://lists.osgeo.org/mailman/listinfo/grass-user
>>> >>
>>> >> End of grass-user Digest, Vol 107, Issue 2
>>> >> ******************************************
>>> >>
>>> >
>>> >
>>> > _______________________________________________
>>> > grass-user mailing list
>>> > grass-user at lists.osgeo.org
>>> > http://lists.osgeo.org/mailman/listinfo/grass-user
>>> >
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: <
>>> http://lists.osgeo.org/pipermail/grass-user/attachments/20150305/74ca5f99/attachment.html
>>> >
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>>
>>> End of grass-user Digest, Vol 107, Issue 9
>>> ******************************************
>>>
>>
>>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150306/e5cfdc0e/attachment-0001.html>


More information about the grass-user mailing list