I am starting on a Twitter bot and having a stupid problem declaring a variable, the code is very simple and stripped everything and it still does not work. When I run the code I get the following error message:
UnboundLocalError: local variable 'Counter' referenced before assignment
I have declared the variable as a global and in different location but still having the same problem.
global Counter
import tweepy, time
def search():
Counter += 1
print("Counter = " + Counter + "\n")
time.sleep(60)
def run():
search()
if __name__ == '__main__':
print "Running"f
while True:
run()