[Tutor] 2.5 to 2.4 problem with Int
Kent Johnson
kent37 at tds.net
Thu Sep 13 14:08:50 CEST 2007
John wrote:
> I've written a program which calculates areas of grid cells distributed
> over the globe. It works fine with Python 2.5, however, when I run it
> with 2.4 (the Enthon edition) I get the following error:
>
> OverflowError: long int too large to convert to int
>
> It occurs on this line:
>
> for ix in range(nx): area[ix,iy]=gridarea
>
> I have no idea which int it's referring to? The values of ix/nx will not
> exceed 360, iy will not exceed 180. Any suggestions on what to change
> for the backward compatability?
Are you sure nx is not large? The argument to range() must be an int. I
would split the line in two so you know which part of it is generating
the error, then insert a print statement to give you some more data.
Kent
More information about the Tutor
mailing list