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
Changes by Chris Jerdonek chris.jerdo...@gmail.com:
--
nosy: +vinay.sajip
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8200
___
___
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
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:
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
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 =
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
Chris Jerdonek chris.jerdo...@gmail.com added the comment:
I agree. Thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8200
___
___
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
___