[issue8200] logging module errors out if log called when multiprocessing module not finished loading

Chris Jerdonek report at bugs.python.org
Mon Mar 22 19:19:37 CET 2010


Chris Jerdonek <chris.jerdonek at gmail.com> added the comment:

Reversing the if-else in Florent's suggestion seems to address points (1) and (2).  Is there a reason to set and check an mp variable rather than simply having the try-except block?

if not logMultiprocessing:
    self.processName = None
else:
    # Errors may occur if multiprocessing has not finished loading
    # yet - e.g. if a custom import hook causes third-party code
    # to run when multiprocessing calls import. See issue 8200
    # for an example
    try:
        self.processName = sys.modules['multiprocessing'].current_process().name
    except StandardError:
        self.processName = 'MainProcess'

Thanks for the quick action!  I'll try in my dev environment when this is settled.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8200>
_______________________________________


More information about the Python-bugs-list mailing list