I am having trouble assigning a variable as global (i think this is my problem, at least).
Heres a representation of my code:
def get_alert():
global subject
# ...code ...
subject = # unread email's subject line
while True:
try:
get_alert()
except EOFError:
get_alert() # try again
else:
if subject == 'specific message here'
# ...code...
From what i've read assigning the variable as global at the top of the get_alert function should allow me to reference it in the while loop, however running the program it tells me, 'NameError: name 'subject' is not defined' for the subject in the while loop