I was trying to create a program which would send me an sms when the intensity of light would fall above and below a specific range of values but when I execute the code the following error comes:
INVALID LITERAL FOR INT() WITH BASE 10.
What should I do to rectify it?
this occurred due to many API requests.This can be fixed by unblocking your API access.Check your email for the link.This issue can also be avoided by upgrading to cloud pro.
@steveblessen98
You have been rate limited by huge amount of API request at a time because AWS have provided some limited bandwidth to operate the request just like the threshold bound. You need to make request after at-least 10 secs and above otherwise you will get a rate limit for up-to 6 hrs. After the rate limit timing is over, again you will be able to make request. If you don’t want any rate limit then you have to upgrade your subscription to cloud pro.
So in the above output it shows rate limit. Try after 2 hrs 45 min 57 sec. That means you will be able to make API request after this time period is over. So for now just wait until rate limit is lifted.
Whenever such error came up Bolt send the detailed information about your rate limitations via your email. Login to your email account and see the information about rate limitations and why they are necessary.
Thanks
It is working now
The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit.
You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .
if val.isdigit():
The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.
Python2.x and Python3.x
Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 .
With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”.
When we have to do some calculation on a string in python, first we need to convert the string into an integer by using function int() .
This function takes a string as input and converts it into an integer.
If we pass non-integer value as a string, it will generate value error in python “invalid literal for int() with base 10”.