Link to home
Start Free TrialLog in
Avatar of astar666
astar666Flag for United States of America

asked on

format string needs a int, but the variable is an int and runtime error

Here is the error message:

 
 
TypeError      Python 2.3.4: /usr/bin/python
Sat Jul 1 19:01:46 2006

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /home/timedimensioncom/cgi-bin/schedulelist.py
  202         myReport.controlSet(0,heading)
  203         if myReport.controlTest(0):
  204                 line="%-8s  %-%6s  %-5s  %-5d  %-8s  %-10s  %-6s  %-40s" % (job,heading,hardwaretype,quantity,doortype,doorno,firelabel,location)
  205                 myReport.reserveLines(2)
  206                 myReport.printLine(line)
line undefined, job = '00000001', heading = '000001', hardwaretype = '', quantity = 1, doortype = '', doorno = '', firelabel = '', location = ''

TypeError: int argument required
      args = ('int argument required',)

the format string only has one int format and this is associated with quantity which appears to be an int

Here is a bigger window on the code:

row=cursor.fetchone()
while row is not None:
      job=dejection(row[0])
      heading=dejection(row[1])
      hardwaretype=dejection(row[2])
      quantity=int(row[3])
      
      doortype=dejection(row[4])
      doorno=dejection(row[5])
      firelabel=dejection(row[6])
      location=dejection(row[7])
      handdegree=dejection(row[8])
      dimensions=dejection(row[9])
      material=dejection(row[10])
      review=row[11]
      keying=row[12]
      other=dejection(row[13])
      item=dejection(row[14])
      itemtype=dejection(row[15])
      mfgcode=dejection(row[16])
      description=dejection(row[17])
      quantityitem=int(row[18])
      
      unit=dejection(row[19])
      cost=row[20]
      instock=row[21]
      keyed=row[22]
      name=dejection(row[23])
      myReport.controlSet(0,heading)
      if myReport.controlTest(0):
            line="%-8s  %-%6s  %-5s  %-5d  %-8s  %-10s  %-6s  %-40s" % (job,heading,hardwaretype,quantity,doortype,doorno,firelabel,location)
            myReport.reserveLines(2)
            myReport.printLine(line)
            myReport.printLine(hyphenbar)
      
Please advise.
ASKER CERTIFIED SOLUTION
Avatar of RichieHindle
RichieHindle

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