How can I assign a value to global variable inside an 'except' block?
x = 5
error_qty = 0
def calcSomething(x):
try:
calc(x)
except ValueError:
print("Something went wrong!!!")
error_qty += 1
In my code error_qty += 1 doesn't work. Python 2.7.5.
I got an exception:
UnboundLocalError: local variable 'processingErrors' referenced before assignment
Thx in advance - I'm out of ideas so far ;)