Hello list, A coworker and I have been trying to use the first example in <http://download.osgeo.org/grass/grass6_progman/pythonlib.html> http://download.osgeo.org/grass/grass6_progman/pythonlib.html. 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: C:\>m.test.py Traceback (most recent call last): File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV/scripts\m.test.py", line 31, in <module> options, flags = grass.parser() File "C:\OSGeo4W\apps\grass\GRASS-~1.0SV\etc\python\grass.py", line 208, in parser os.execvp("g.parser", [name] + argv) File "C:\OSGeo4W\apps\Python25\lib\os.py", line 353, in execvp _execvpe(file, args) File "C:\OSGeo4W\apps\Python25\lib\os.py", line 389, in _execvpe func(fullname, *argrest) OSError: [Errno 22] Invalid argument Any ideas what is going on? Bob #==================================================== #!/usr/bin/env python #%Module #% description: Checks if vector map is 3D #% keywords: vector #%End #%option #% key: map #% type: string #% gisprompt: old,vector,vector #% key_desc: name #% description: Name of vector map #% required: yes #%end import sys import grass def main(): info = grass.parse_command('v.info', flags = 't', map = options['map']) if info['map3d'] == '1': print 'Vector map is 3D' else: print 'Vector map is 2D' return 0 if __name__ == "__main__": options, flags = grass.parser() sys.exit(main())
Bob Moskovitz Research Analyst I Seismic Hazard Zonation Project California Geological Survey http://www.conservation.ca.gov/cgs/shzp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 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.
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
