[Tutor] error message

Emile van Sebille emile at fenx.com
Wed Jul 8 20:13:15 CEST 2009


On 7/8/2009 9:13 AM Steven Buck said...
> I'm running a for loop which returns an error message after the third 
> iteration (see out[4] at the bottom as evidence).  I don't understand 
> the error message.  Although I'll continue to do my own digging to 
> debug, I thought I'd give you all a shot.  Thanks, -steve
>  
<snips>

age[(i)] = psid.psid[i][20]

Here you're getting the 20th field from the 4th record.  So, assuming 
the tools you're using are OK...

> --> 150         d = unpack(self._header['byteorder']+fmt, byt)[0]

> error: unpack requires a string argument of length 1

... you get an unpack error.  So my money's on a source data problem.

you might try...

for ii in range(40):
     print psid.psid[3][ii]

...and see what you get.  It's likely a bad record of some sort.  You 
might need to allow for those...


HTH,

Emile




More information about the Tutor mailing list