[Qgis-developer] A stupid problem with python, that is making me more stupid :)

Alessandro Pasotti apasotti at gmail.com
Tue Mar 11 05:03:28 PDT 2014


2014-03-11 12:56 GMT+01:00 Geo DrinX <geodrinx at gmail.com>:

> Hello All,
>
>
> as in object,  I had an error from python, with my source code, that I do
> not understand
>
>
>     CamNick = 90 - int(pitch)
> ValueError: invalid literal for int() with base 10: '36.30'
>
>
> Somebody can help me to understand why   "36.30"  is not  good to reurn an
> int value ?
>
> For me, is a mistery.  :(
>


You can't convert a string that represents a float to an integer, you
should first convert to float then to int:

int(float('36.30'))

BTW this kind of questions should not be asked here but on one of the
several python mailing lists.


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140311/77ec30c0/attachment.html>


More information about the Qgis-developer mailing list