[GRASS-user] script in python

Moritz Lennert mlennert at club.worldonline.be
Mon Dec 1 09:31:40 EST 2008


On 01/12/08 15:23, Gabriele Nolè wrote:
> Hi Jose.	
> I changed the code by trying different solutions, such as:
> ------------------------------------------------------------------------------------------
> def main():
> 	vect1 = options['vect_1']
> 	vect2 = options['vect_2']
> 	vect3 = options['vect_3']
> 	
>        
> vbuffer=subprocess.Popen('v.buffer','input=vect_1','output=buffer_200m','buffer=200')
> 	retcode=vbuffer.wait()  
> 	 
>       # Then I also tried with another command (v.db.addcol):
>       #import subprocess
>      
> #vaddcol=subprocess.Popen('v.db.addcol','map=vect_1','columns=prova','VARCHAR(15)')


The parameter for v.db.addcol is columns='prova varchar(15)'. I don't 
think you can split that up into two parameters. Shouldn't this be:

vaddcol=subprocess.Popen('v.db.addcol','map=vect_1','columns=prova 
VARCHAR(15)')

?
(don't know if the white space is allowed as such or whether you need to 
quote the entire parameter as "prova VARCHAR(15)")

Moritz


More information about the grass-user mailing list