<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>Hello 
list,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>A coworker and 
I&nbsp;have been trying to use the first example in <A class=main-link 
href="http://download.osgeo.org/grass/grass6_progman/pythonlib.html" 
target=cgiirc58863><FONT face="Times New Roman" 
size=3>http://download.osgeo.org/grass/grass6_progman/pythonlib.html</FONT></A>.&nbsp; 
We discovered that "import grass.script as grass" has to be changed to "import 
grass".&nbsp; Below is the example and the error we are getting is 
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009>C:\&gt;m.test.py<BR>Traceback (most recent call 
last):<BR>&nbsp; File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV/scripts\m.test.py", 
line 31, in &lt;module&gt;<BR>&nbsp;&nbsp;&nbsp; options, flags = 
grass.parser()<BR>&nbsp; File 
"C:\OSGeo4W\apps\grass\GRASS-~1.0SV\etc\python\grass.py", line 208, in 
parser<BR>&nbsp;&nbsp;&nbsp; os.execvp("g.parser", [name] + argv)<BR>&nbsp; File 
"C:\OSGeo4W\apps\Python25\lib\os.py", line 353, in execvp<BR>&nbsp;&nbsp;&nbsp; 
_execvpe(file, args)<BR>&nbsp; File "C:\OSGeo4W\apps\Python25\lib\os.py", line 
389, in _execvpe<BR>&nbsp;&nbsp;&nbsp; func(fullname, *argrest)<BR>OSError: 
[Errno 22] Invalid argument</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>Any ideas what is 
going on?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009>Bob</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=493111121-12062009></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009></SPAN></FONT><FONT 
face=Arial size=2><SPAN class=493111121-12062009></SPAN></FONT><FONT face=Arial 
size=2><SPAN class=493111121-12062009></SPAN></FONT><FONT face=Arial 
size=2><SPAN class=493111121-12062009></SPAN></FONT><FONT face=Arial 
size=2><SPAN class=493111121-12062009></SPAN></FONT><FONT face=Arial 
size=2><SPAN 
class=493111121-12062009>#====================================================</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>#!/usr/bin/env 
python</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>#%Module<BR>#% 
description: Checks if vector map is 3D<BR>#% keywords: 
vector<BR>#%End<BR>#%option<BR>#% key: map<BR>#% type: string<BR>#% gisprompt: 
old,vector,vector<BR>#% key_desc: name<BR>#% description: Name of vector map 
<BR>#% required: yes<BR>#%end</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>import sys<BR>import 
grass</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>def 
main():<BR>&nbsp;&nbsp;&nbsp; info = 
grass.parse_command('v.info',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
flags = 
't',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map = options['map'])<BR>&nbsp;&nbsp;&nbsp; if info['map3d'] == 
'1':<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'Vector map is 
3D'<BR>&nbsp;&nbsp;&nbsp; else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
print 'Vector map is 2D'</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>&nbsp;&nbsp;&nbsp; 
return 0</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>if __name__ == 
"__main__":<BR>&nbsp;&nbsp;&nbsp; options, flags = 
grass.parser()<BR>&nbsp;&nbsp;&nbsp; sys.exit(main())<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>
<DIV class=Section1>
<P><B><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Bob 
Moskovitz</SPAN></B> <BR><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Research Analyst 
I</SPAN></B> <BR><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Seismic Hazard Zonation 
Project</SPAN></B><BR><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">California Geological 
Survey</SPAN></B> <BR><B><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">http://www.conservation.ca.gov/cgs/shzp</SPAN></B><SPAN 
style="COLOR: blue"><?xml:namespace prefix = o ns = 
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: gray; FONT-FAMILY: Arial">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.</SPAN></P></DIV></DIV></BODY></HTML>