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

2010-03-22 Thread Chris Jerdonek
New submission from Chris Jerdonek chris.jerdo...@gmail.com: The logging module errors out if the multiprocessing module is not finished loading when logging.log() is called. This can happen, for example, if a custom import hook is defined that causes third-party code to execute when the

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

2010-03-22 Thread Chris Jerdonek
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8200 ___ ___

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

2010-03-22 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: A slightly more generic fix checked into trunk (r79279), please verify in your environment. -- assignee: - vinay.sajip resolution: - fixed status: open - closed ___ Python tracker

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

2010-03-22 Thread Florent Xicluna
Florent Xicluna florent.xicl...@gmail.com added the comment: I would suggest something like: if logMultiprocessing: try: self.processName = sys.modules['multiprocessing'] .current_process().name except StandardError: self.processName = 'MainProcess' else:

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

2010-03-22 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: It's structured the way it is for two reasons: 1. IMO It's better (more readable) to have the simpler case in the then clause and the more complicated case in the else clause. 2. If multiprocessing is not used, the process name needs to

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

2010-03-22 Thread Chris Jerdonek
Chris Jerdonek chris.jerdo...@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 =

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

2010-03-22 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: - Original Message 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? Just that it went over

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

2010-03-22 Thread Chris Jerdonek
Chris Jerdonek chris.jerdo...@gmail.com added the comment: I agree. Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8200 ___ ___

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

2010-03-22 Thread Chris Jerdonek
Chris Jerdonek chris.jerdo...@gmail.com added the comment: FYI, I verified the fix in my local environment. Thanks again. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8200 ___