[portland] Please explain this error

Rich Shepard rshepard at appl-ecosys.com
Wed Jan 16 20:38:45 CET 2008

   I need to identify every item belonging to another variable. Each item has
a sequential number which is extracted from a database table and stored in
the tuple called 'row'. Using this code fragment:

      for i in range(row[16]):
         idx = i+1
         print row[1], '\t', idx

the results include:

 	Sedimentation   1
 	Sedimentation   2
 	Sedimentation   3
 	InfiltrationRate        1
 	InfiltrationRate        2
 	InfiltrationRate        3
Traceback (most recent call last):
   File "eikos.py", line 145, in OnProjParms
   File "/data1/eikos/reports.py", line 394, in inputVals
     for i in range(row[16]):
TypeError: range() integer end argument expected, got unicode.

   Since the code _seems_ to work properly I don't understand why it doesn't
end cleanly. I understand the words in the error message but not what I need
to do to fix it.



Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863

More information about the Portland mailing list