I hope somebody can help me. :)
I am calling a python script from PHP, with the help from phpseclib/ssh2 i ssh into my server and it works fine.
My problem is that if i use "time.sleep(5)" in the loop of my python script i dont get a result back, but if i remove time.sleep(5) and time.sleep(3) it works.
Anybody have an idea why this happen?
If i try the python script i my console everything is picture perfect.!
items = [
    '1',
    '2',
    '3'
]
    itemArray = {}
    def checker():
        for item in items:
            time.sleep(5) # If added not working, if removed working, result gets send back
            position = 1  # keeps track of the ranking position
            for start in range(int(deep)):
                time.sleep(3)
                results = 'something'
                for div in results:
                    try:
                        if div.find('i', href=True)['href'].find(something) != -1:
                            exit_conditon = True
                            break
                        else:
                            position += 1
                    except:
                        print "Unexpected error:", sys.exc_info()[0]
                        raise
                if 'exit_conditon' in locals():
                    if exit_conditon is True:
                        exit_conditon = False
                        itemArray.update({value: 1})
                        break
        sys.exit(itemArray)
    checker() 
Please help.
Update: if i have 3 rows in the items array i need to remove the second time.sleep(5) to get it working, if i have 2 items in my array i only need to remove the first time.sleep(5).
 
     
    