Forum Discussion

TVENTAdmin's avatar
TVENTAdmin
Qrew Member
3 years ago

invalid literal for int() with base 10:

I am currently building a pipeline that uses a Webhook to make an API call into openweathermap.org and return a daily JSON file with that day's weather conditions. 

I then sort through the JSON file using some REGEX code to splice out the data that I want, and am attempting to file that data and build new entries in a Weather Table in one of my apps. I've done this same process with a different API call and had no issues. However, I am currently running into a problem when I try inputting the sorted data into my tables fields in the third step. I keep getting the following error.

invalid literal for int() with base 10: 'WindSpeed'

I have tried a myriad of different things including changing the table field from numeric, to text, to numeric currency. I have also tried using Jinja to transform my incoming data using {{b.WindSpeed|int}}, {{b.WindSpeed|float}}, {{b.WindSpeed|string}}. 

Has anyone else had this issue? Or have any other ideas of how to address this?

------------------------------
TVENT Admin
------------------------------
  • Did you ever find out what the problem was? What was your resolution if you did find a solution?

    ------------------------------
    Russell Hansen
    ------------------------------
  • PaulPeterson1's avatar
    PaulPeterson1
    Qrew Assistant Captain
    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.

    ------------------------------
    Paul Peterson
    ------------------------------
  • DougHenning1's avatar
    DougHenning1
    Community Manager
    Sounds like you did a query step but didn't use a loop on the results. If you're not using a loop you need to specify the index explicitly:  {{ b[0].windspeed }}

    Hope that helps!

    ------------------------------
    Doug Henning
    ------------------------------
    • BarryDolan's avatar
      BarryDolan
      Qrew Cadet

      Thank you, Doug. I was getting this same error on an unrelated Pipeline and your solution was the solution I needed. It just goes to show that specific errors may be indirectly related to a myriad of other issues and a simple fix is all that's needed. We just need to tap into our resources and ask the right questions!

      I'm so grateful for this wealth of community knowledge. 



      ------------------------------
      Barry Dolan
      ------------------------------