[GRASS-user] Error running r.reclass in python script with stdin

Johannes Radinger JRadinger at gmx.at
Tue Mar 6 05:42:45 EST 2012


Hi,

I try to run a python script including the r.reclass command with stdin.
I am running GRASS 6.5.svn50782M (2012) on a Mac OSX. The part of the script is:

	grass.run_command("r.reclass",
					input = "Treene_tmp_mask1",
					rules = "-",
					stdin = '1 thru 999 = 1 1',
					output = "Treene_mask_2")

and the error:
Traceback (most recent call last):
  File "/Users/Johannes Radinger/Desktop/SDM_V2R.py", line
92, in <module>
    sys.exit(main())
  File "/Users/Johannes Radinger/Desktop/SDM_V2R.py", line
68, in main
    output = "Treene_mask_2")
  File "/Applications/GRASS-6.5.app/Contents/MacOS/etc/pytho
n/grass/script/core.py", line 189, in run_command
    ps = start_command(*args, **kwargs)
  File "/Applications/GRASS-6.5.app/Contents/MacOS/etc/pytho
n/grass/script/core.py", line 177, in start_command
    return Popen(args, **popts)
  File "/Applications/GRASS-6.5.app/Contents/MacOS/etc/pytho
n/grass/script/core.py", line 56, in __init__
    startupinfo, creationflags)
  File "/Library/Frameworks/Python.framework/Versions/2.6/li
b/python2.6/subprocess.py", line 616, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout,
stderr)
  File "/Library/Frameworks/Python.framework/Versions/2.6/li
b/python2.6/subprocess.py", line 973, in _get_handles
    p2cread = stdin.fileno()
AttributeError: 'str' object has no attribute 'fileno'


What I am doing wrong or is there a bug in the code?

best regards,
Johannes 
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a


More information about the grass-user mailing list