[GRASSGUI] initiating d.* command dialogs with existing parameters

Michael Barton michael.barton at asu.edu
Sun Mar 25 13:47:08 EDT 2007


Thanks much for the advice on how to make this work properly. Sorry about
the images. I forgot to take that out. I'd added that so that I could test
code from the wxPython demo--to try and debug something.

Michael


On 3/25/07 9:41 AM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> 
> Michael Barton wrote:
> 
>> I can't remember the exact error, but it said essentially that "PIPE" is not
>> a valid parameter. This could be a bug in the Mac version, of course. But it
>> would be nice to see if it works on another platform before I report it, in
>> case I've just forgotten some punctuation, capitalization, or something.
> 
> You either need to use subprocess.PIPE, or change "import subprocess"
> to "from subprocess import *". If you take the latter approach, you
> need to remove the "subprocess." prefix from subprocess.call,
> subprocess.Popen etc.
> 
> The "import <module>" syntax requires you to use qualified names,
> while "from <module> import *" allows you to use unqualified names.
> 
> Alternatively, you can import specific identifiers, e.g.:
> 
> from subprocess import (call, Popen, PIPE, STDOUT)
> 
> In any case, the call:
> 
>             self.out = Popen(cmd, shell=True, stdout=PIPE,
> stderr=STDOUT).communicate()[0]
> 
> seems to work once the relevant identifiers have been imported.
> 
> BTW, GMConsole.runCmd() currently executes the command twice; once
> with call(), and again with os.popen().
> 
> Also, I had to remove an "import images" statement from wxgui.py; that
> module doesn't appear to exist.

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton





More information about the grass-gui mailing list