At interpreter shutdown, the module's global variables are set to None before the module itself is released. See warning at http://docs.python.org/2/reference/datamodel.html#object.__del__ for more details.