@@ -2554,6 +2554,13 @@ def get_label(y, default_name):
2554
2554
def _putmask (a , mask , values ):
2555
2555
return np .copyto (a , values , where = mask )
2556
2556
2557
+ _lockstr = """\
2558
+ LOCKERROR: matplotlib is trying to acquire the lock {!r}
2559
+ and has failed. This maybe due to any other process holding this
2560
+ lock. If you are sure no other matplotlib process in running try
2561
+ removing this folder(s) and trying again.
2562
+ """
2563
+
2557
2564
2558
2565
class Locked (object ):
2559
2566
"""
@@ -2565,29 +2572,31 @@ class Locked(object):
2565
2572
All Rights Reserved
2566
2573
2567
2574
conda is distributed under the terms of the BSD 3-clause license.
2568
- Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
2575
+ Consult LICENSE_CONDA or http://opensource.org/licenses/BSD-3-Clause.
2569
2576
"""
2577
+ LOCKFN = '.matplotlib_lock'
2578
+
2570
2579
def __init__ (self , path ):
2571
- LOCKFN = '.matplotlib_lock'
2572
2580
self .path = path
2573
2581
self .end = "-" + str (os .getpid ())
2574
- self .lock_path = os .path .join (self .path , LOCKFN + self .end )
2575
- self .pattern = os .path .join (self .path , LOCKFN + '-*' )
2582
+ self .lock_path = os .path .join (self .path , self . LOCKFN + self .end )
2583
+ self .pattern = os .path .join (self .path , self . LOCKFN + '-*' )
2576
2584
self .remove = True
2577
2585
2578
2586
def __enter__ (self ):
2579
- retries = 10
2587
+ retries = 50
2580
2588
sleeptime = 1
2581
2589
while retries :
2582
2590
files = glob .glob (self .pattern )
2583
2591
if files and not files [0 ].endswith (self .end ):
2584
2592
time .sleep (sleeptime )
2585
- sleeptime *= 2
2593
+ sleeptime *= 1.1
2586
2594
retries -= 1
2587
2595
else :
2588
2596
break
2589
2597
else :
2590
- raise RuntimeError (lockstr )
2598
+ err_str = _lockstr .format (self .pattern )
2599
+ raise RuntimeError (err_str )
2591
2600
2592
2601
if not files :
2593
2602
try :
0 commit comments