Hi,
I have some questions concerning the behaviour of gparser.
In the attachment you can find a example-python-script.
Somehow the output from gparser for X (see script) is strange: I try
to use it in a if-command but somehow I fail.
The output when X is set to 'A a' should be a juhuu but it isn't.
I was looking for the bug in my code but somehow I couldn't find it.
When I replace the options for X with A,B and C (single Letters), it
seems to work...Is there a problem with spaces in the options of gparser?
I am working on GRASS6.5SVN on Mac OS X 10.6.8.
Can anyone try the script and reproduce the error? Does anyone have ideas where
the problem in the script is located?
Thank you for your help.
Best regards,
Johannes
--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
#!/usr/bin/env python
#
#
# MODULE: test
#
# AUTHOR(S): Johannes Radinger
#
# VERSION: V1.0 Beta
#
# DATE: 2011-05-12
#
#
#%Option
#% key: X
#% type: string
#% required: no
#% multiple: no
#% key_desc: name
#% description: ABC
#% options: A a,B b,C c
#% answer: B b
#%end
# import required base modules
import sys
import os
# import required grass modules
import grass.script as grass
def main():
X = str(options['X'])
#X = 'A a'
print X
print type(X)
if X is 'A a':
print juh
sys.stdout.flush()
if __name__ == __main__:
options, flags = grass.parser()
sys.exit(main())
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user