[GRASS-dev] new strange error

Any idea why the following statement…

grass.run_command(‘g.remove’, rast=‘s%’ % panmatch1)

…raises the following error…

Traceback (most recent call last):
File “/Users/cmbarton/Library/GRASS/7.0/Modules/scripts/i.pansharpen”, line 417, in
main()
File “/Users/cmbarton/Library/GRASS/7.0/Modules/scripts/i.pansharpen”, line 145, in main
grass.run_command(‘g.remove’, rast=‘s%’ % panmatch1)
ValueError: incomplete format

but this statement…

grass.run_command(‘g.remove’, rast=panmatch1)

…does not.

panmatch1 is a string variable that stores a temporary file name. In this run, the value of panmatch1 = “10707_pan1”

Michael


C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

I figured it out.

Michael

On Jun 18, 2012, at 10:53 PM, Michael Barton wrote:

Any idea why the following statement…

grass.run_command(‘g.remove’, rast=‘s%’ % panmatch1)

…raises the following error…

Traceback (most recent call last):
File “/Users/cmbarton/Library/GRASS/7.0/Modules/scripts/i.pansharpen”, line 417, in
main()
File “/Users/cmbarton/Library/GRASS/7.0/Modules/scripts/i.pansharpen”, line 145, in main
grass.run_command(‘g.remove’, rast=‘s%’ % panmatch1)
ValueError: incomplete format

but this statement…

grass.run_command(‘g.remove’, rast=panmatch1)

…does not.

panmatch1 is a string variable that stores a temporary file name. In this run, the value of panmatch1 = “10707_pan1”

Michael


C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu


C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

2012/6/19 Michael Barton <Michael.Barton@asu.edu>:

grass.run_command('g.remove', rast='s%' % panmatch1)

should be '%s', not 's%'

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa