[Tutor] 2.5 to 2.4 problem with Int

John washakie at gmail.com
Thu Sep 13 21:27:07 CEST 2007


The error occurs here:
area[ix,iy]=gridarea

The values of nx, ix, iy leading up to the error are:
360 0 0
360 1 0
360 2 0
360 3 0
360 4 0
360 ... ...
360 357 9
360 358 9
360 359 9
360 0 10
OverflowError: long int too large to convert to int

I guess then the problem occurs when iy goes from 9 to 10, but why?? It
wasn't a problem before and it's not a problem for ix???

Thanks!


On 9/13/07, Kent Johnson <kent37 at tds.net> wrote:
>
> 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
>



-- 
Configuration
``````````````````````````
Plone 2.5.3-final,
CMF-1.6.4,
Zope (Zope 2.9.7-final, python 2.4.4, linux2),
Five 1.4.1,
Python 2.4.4 (#1, Jul 3 2007, 22:58:17) [GCC 4.1.1 20070105 (Red Hat
4.1.1-51)],
PIL 1.1.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070913/031a0f60/attachment.htm 


More information about the Tutor mailing list