Hello,
I have been trying to figure out the problem with this string formatting:

sql = 'INSERT INTO tc_themes (name,user_made,hour12,time_loc,background_color_r,' + \
                'background_color_g,background_color_b,clock_color_r,clock_color_g,' + \
                'clock_color_b,clock_background_color_r,clock_background_color_g,' + \
                'clock_background_color_b,clock_points_color_r,clock_points_color_g,' + \
                'clock_points_color_b,clock_hour_color_r,clock_hour_color_g,' + \
                'clock_hour_color_b,clock_min_color_r,clock_min_color_g,' + \
                'clock_min_color_b,clock_sec_color_r,clock_sec_color_g,' + \
                'clock_sec_color_b,clock_font_facename,clock_font_size,' + \
                'clock_font_style,clock_font_underlined,clock_font_weight,' + \
                'clock_font_color_r,clock_font_color_g,clock_font_color_b,' + \
                'time_font_facename,time_font_size,time_font_style,' + \
                'time_font_underlined,time_font_weight,time_font_color_r,' + \
                'time_font_color_g,time_font_color_b) VALUES (' + \
                "%s,%i,%i,%s,%i," + \
                "%i,%i,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%s,%i," + \
                "%i,%i,%i," + \
                "%i,%i,%i," + \
                "%s,%i,%i," + \
                "%i,%i,%i," + \
                "%i,%i)" % ("'Simple Clock'", 0, 1, "'Top'", 200, 200, 200, 100, 100, 100, 255, 255, 255, 100, 100, 100, 0, 0, 0, 0, 0, 0, 255, 0, 0, "'Arial'", 18, 90, 0, 90, 0, 0, 0, "'Arial'", 32, 90, 0, 90, 0, 0, 0)

when it executes, I get this error: "inv argument required". I have checked and rechecked both the string and the tuple. I cant figure out what the problem is.
After playing around with it, i found out if change the last line to: "%s,%i) %(... I get a different error. The error is "not all arguments converted during string formatting".

So I am baffled and confused as of why this wont work. Is anyone able to shed some light on my hidden bug?

Using: Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]

--
-Echo
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to