Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. bennetcole
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Best 0
    • Groups 0

    bennetcole

    @bennetcole

    0
    Reputation
    11
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    bennetcole Unfollow Follow

    Latest posts made by bennetcole

    • RE: cerebro.run ValueError: invalid literal for int() with base 10

      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".

      posted in General Code/Help
      B
      bennetcole