[GRASS-user] Problems with GRASS python code in osgeo4w

Moskovitz, Bob Bob.Moskovitz at conservation.ca.gov
Mon Jul 13 13:33:25 EDT 2009


See comments below.

Glynn Clements wrote:

> > GRASS 6.4.0svn (Morgan_Hill)> assoc .py
> > .py=py_auto_file
> > 
> > GRASS 6.4.0svn (Morgan_Hill)> ftype py_auto_file
> > py_auto_file="C:\OSGeo4W\bin\python.exe" "%1" %*
> > 
> > GRASS 6.4.0svn (Morgan_Hill)> C:\Temp\printargs.py this is a test
> > C:\Temp\printargs.py
> > 
> > GRASS 6.4.0svn (Morgan_Hill)> python C:\Temp\printargs.py 
> this is a test
> > C:\Temp\printargs.py
> > this
> > is
> > a
> > test
> 
> Okay, so Python is working fine.
> 

If python is working, can you explain why my first example ( C:\Temp\printargs.py this is a test ) only prints out sys.argv[0] ?  
I believe that my problem has nothing to do with g.parser.  I believe that the arguments to a python script are being stripped 
when you rely on ftype.

> There have been some bugs fixed recently regarding g.parser on
> Windows.
> 

Based on http://trac.osgeo.org/osgeo4w/wiki/pkg-grass, I see that OSGEO4W's GRASS (which is about 4 months old) probably don't 
have many of these fixes.  So, I would like to make a request to the GRASS Devs to make RC5 available to OSGEO4W.  It's a shame
that the OSGEO4W community can't be involved in squashing the last few bugs :-)

> The first thing to check with a GRASS script is that "script --help"
> generates the help message. If it doesn't, that indicates that either
> g.parser isn't being called or it isn't being passed the script's
> filename correctly.
> 
> If --help works but invoking the script with other arguments doesn't
> work, that indicates that g.parser is failing to re-invoke the script.
> 

		script --help							No output
		c:\full\path\to\script --help					No output
		python c:\full\path\to\script --help			Help message

		script --ui								No output
		c:\full\path\to\script --ui					No output
		python c:\full\path\to\script --ui				No output

		script --interface-description				No output
		c:\full\path\to\script --interface-description		No output
		python c:\full\path\to\script --interface-description	XML output

> If the script requires arguments, running the script without arguments
> should bring up the GUI. Some bugs with this were fixed quite
> recently, but I don't know if others remain.

Btw, most (if not all) of the compiled grass commands do not bring up the GUI when you run the program without arguments.

> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>
> 

Bob Moskovitz
Research Analyst I
Seismic Hazard Evaluation Project
California Geological Survey
http://gmw.consrv.ca.gov/shmp

CONFIDENTIALITY NOTICE: This communication is intended only for the use of the individual or entity to which it is addressed. This message contains information from the State of California, California Geological Survey, which may be privileged, confidential and exempt from disclosure under applicable law, including the Electronic Communications Privacy Act. If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.



More information about the grass-user mailing list