While debugging a problem I have simplified the program in question to just few lines, but I still do not understand what's wrong. Could you please help?
UnboundLocalError: local variable 'logging' referenced before assignment
W: 5, 4: Redefining name 'logging' from outer scope (line 1)
import logging.handlers as lh
logging.warning function will try to reference the variable from local scope first in
setup() function, which is from
import logging.handlers, and it finds it to be declared after the line you're using it.
Try changing it to:
import logging def setup(): global logging logging.warning("start") import logging.handlers setup()