<!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> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>A coworker and
I 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>.
We discovered that "import grass.script as grass" has to be changed to "import
grass". 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> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=493111121-12062009>C:\>m.test.py<BR>Traceback (most recent call
last):<BR> File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV/scripts\m.test.py",
line 31, in <module><BR> options, flags =
grass.parser()<BR> File
"C:\OSGeo4W\apps\grass\GRASS-~1.0SV\etc\python\grass.py", line 208, in
parser<BR> os.execvp("g.parser", [name] + argv)<BR> File
"C:\OSGeo4W\apps\Python25\lib\os.py", line 353, in execvp<BR>
_execvpe(file, args)<BR> File "C:\OSGeo4W\apps\Python25\lib\os.py", line
389, in _execvpe<BR> func(fullname, *argrest)<BR>OSError:
[Errno 22] Invalid argument</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=493111121-12062009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=493111121-12062009></SPAN></FONT> </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> </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> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=493111121-12062009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=493111121-12062009></SPAN></FONT> </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> </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> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>import sys<BR>import
grass</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>def
main():<BR> info =
grass.parse_command('v.info',<BR>
flags =
't',<BR>
map = options['map'])<BR> if info['map3d'] ==
'1':<BR> print 'Vector map is
3D'<BR> else:<BR>
print 'Vector map is 2D'</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>
return 0</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=493111121-12062009>if __name__ ==
"__main__":<BR> options, flags =
grass.parser()<BR> sys.exit(main())<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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>