Skip to content Skip to sidebar Skip to footer

Value Of Variable Disappears After Few Function Calls

I'm making a parser with proxy support, couse of using free proxies, they often dies, so my code switch to other proxy, no problems here, but couse of switching i rerun function mu

Solution 1:

To elaborate on @depperm's comment, the problem is likely your recursive function not returning anything. For instance your execution flow may look like:

con(where) <- which DOESN'Treturn HTML to this one<-|
    -> error                                         | 
       ->con(where)                                 |<-to this call here-|
          -> error                                                        |
             ->con(where)                                                |
                 -> success -> returns HTML       ->->->  |

However, if you change the block

except requests.exceptions.ConnectionError:
        con(where)

To:

    except requests.exceptions.ConnectionError:
        return con(where)

Then the resulting HTML will be fed back up the chain through all the recursive functions as you intended (or so we believe, but cannot confirm since it is not a MCVE

Post a Comment for "Value Of Variable Disappears After Few Function Calls"