[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TypeError: not all arguments converted during string formatting

Posted on 2011-10-30
2
Medium Priority
?
537 Views
Last Modified: 2012-05-12
first go around with mysql and OI keep getting this error ... what does it mean and why am I getting it ?


Traceback (most recent call last):
  File "C:\Python26\lib\threading.py", line 532, in __bootstrap_inner
    self.run()
  File "C:\Python26\sign\OCTOBER29_mysqldevlopment.py", line 6885, in run
    Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp))
  File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 158, in execute
    query = query % db.literal(args)
TypeError: not all arguments converted during string formatting

Open in new window


	   #get transferred information
	    conn = lite.connect("PermPatRecord.sqlite")
	    c = conn.cursor()
	    c.execute('select * from ptrecords')
	    for rows in c:
		Actual_Incident_number=(str(rows[0]))		
		Incident_number = (str(rows[1]))
		Age= (str(rows[4]))
		Gender = (str(rows[5]))
		Zip = (str(rows[8]))
		Ailment = (str(rows[10]))
		Treatment =(str( rows[11]))
		Initial_contact= (str(rows[13]))
		Hospital = (str(rows[14]))
		Inservice= (str(rows[16]))
		Destination= (str(rows[15]))
		Sys =(str(rows[19]))
		Dia=(str(rows[20]))
		Pulse=(str(rows[21]))
		Resp=(str(rows[22]))
		Weather=(str(rows[23]))
		Temp=(str(rows[24]))
		Humid=(str(rows[25]))
		Wind=(str(rows[26]))
		TimeStamp=(str(rows[27]))
			
		conn = MySQLdb.connect (host = 'localhost', user = 'root' ,passwd = '', db = 'transferdb')
		
		#connect = lite.connect('backup.sqlite')
		cur = conn.cursor()
		cur.execute('INSERT INTO ptrecords VALUES(%s, %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s)',
		            (Actual_Incident_number, Age,Gender,Zip,Ailment,Treatment,Initial_contact,Hospital,Destination,Inservice,
		             Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp))
		#co.execute("INSERT INTO fundata (name, price, LastUpdate) VALUES(%s, %s, %s);",q)

		conn.commit()
		cur.close()
		conn.close()

Open in new window

0
Comment
Question by:dolamitejenkins
2 Comments
 
LVL 17

Accepted Solution

by:
sweetfa2 earned 2000 total points
ID: 37054959
In line 31 you do not have enough %s to match the number of arguments you are passing to the insert statement.
0
 

Author Closing Comment

by:dolamitejenkins
ID: 37059533
thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question