views:

43

answers:

2

Hi everyone,

I have this simple python expression:

fscript.write (("update %s va set %s = %s where %s = %s;") % (argv[1],argv[2],vl[0],argv[3],vl[1]))

And I would expect to receive output like this

update some_table va set active_id = 1 where id = 5;
update some_table va set active_id = 1 where id = 3;
...more lines...

However, i'm getting this

update some_table va set active_id = 1 where id = 5
;update some_table va set active_id = 1 where id = 3
...more lines....

Anything i'm missing ?

Thanks in advance

+1  A: 

I would try adding a strip() to your latest parameter that could end with \n.

fscript.write (("update %s va set %s = %s where %s = %s;") % (argv[1],argv[2],vl[0],argv[3],vl[1].strip()))
systempuntoout
Nice, didn't think about that.
Tom
+1  A: 

Some value of vl[1] is a string with a newline in it, not an integer.

S.Lott