@@ -2451,6 +2451,13 @@ def get_label(y, default_name):
24512451 def _putmask (a , mask , values ):
24522452 return np .copyto (a , values , where = mask )
24532453
2454+ _lockstr = """\
2455+ LOCKERROR: matplotlib is trying to acquire the lock {!r}
2456+ and has failed. This maybe due to any other process holding this
2457+ lock. If you are sure no other matplotlib process in running try
2458+ removing this folder(s) and trying again.
2459+ """
2460+
24542461
24552462class Locked (object ):
24562463 """
@@ -2462,29 +2469,31 @@ class Locked(object):
24622469 All Rights Reserved
24632470
24642471 conda is distributed under the terms of the BSD 3-clause license.
2465- Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
2472+ Consult LICENSE_CONDA or http://opensource.org/licenses/BSD-3-Clause.
24662473 """
2474+ LOCKFN = '.matplotlib_lock'
2475+
24672476 def __init__ (self , path ):
2468- LOCKFN = '.matplotlib_lock'
24692477 self .path = path
24702478 self .end = "-" + str (os .getpid ())
2471- self .lock_path = os .path .join (self .path , LOCKFN + self .end )
2472- self .pattern = os .path .join (self .path , LOCKFN + '-*' )
2479+ self .lock_path = os .path .join (self .path , self . LOCKFN + self .end )
2480+ self .pattern = os .path .join (self .path , self . LOCKFN + '-*' )
24732481 self .remove = True
24742482
24752483 def __enter__ (self ):
2476- retries = 10
2484+ retries = 50
24772485 sleeptime = 1
24782486 while retries :
24792487 files = glob .glob (self .pattern )
24802488 if files and not files [0 ].endswith (self .end ):
24812489 time .sleep (sleeptime )
2482- sleeptime *= 2
2490+ sleeptime *= 1.1
24832491 retries -= 1
24842492 else :
24852493 break
24862494 else :
2487- raise RuntimeError (lockstr )
2495+ err_str = _lockstr .format (self .pattern )
2496+ raise RuntimeError (err_str )
24882497
24892498 if not files :
24902499 try :
0 commit comments