I’m currently using the following line of code in my Social Accumulator IMP project.
viewCount =viewCountStr.tointeger()
It works great most of the time but about once a day something goes wrong when the Agent is reading data from the Facebook API and then my variable “viewCountStr” doesn’t actually contain a number.
When that happens my Agent throws up an error “[Agent] cannot convert the string”
I would like to do some error checking and am wondering how I can test to see if it is possible to convert to an integer before trying.
Any ideas?
http://forums.electricimp.com/discussion/2192/social-accumulator#Item_2