I would like to get some kind of confirmation that the upload is success, I have my methods defined similar to the following. However the value of global variable is not changing. Please help
global upload_confirm
upload_confirm = False
def confirm_upload():
upload_confirm = True
def start_new_upload():
confirm_upload()
while (upload_confirm != True):
print "waiting for upload to be true"
time.sleep(5)
if (upload_confirm == True):
print "start Upload"
start_new_upload()
You could try this:
def confirm_upload():
global upload_confirm
upload_confirm = True
Since you are doing upload_confirm = True in a local scope, Python treat it like a local variable. Hence, your global variable stays the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With