Link to home
Start Free TrialLog in
Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America

asked on

TypeError: not all arguments converted during string formatting

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

ASKER CERTIFIED SOLUTION
Avatar of sweetfa2
sweetfa2
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dolamite Jenkins

ASKER

thanks