Eryk Sun <[email protected]> added the comment:
A sub-millisecond wait is fairly quick, but it depends on the machine speed. I
should have included a counter. Try the following. It's not reproducing the
problem if num_retries doesn't get incremented.
import os
import time
ERROR_DIR_NOT_EMPTY = 145
PARENT_PATH = 'foo'
CHILD_PATH = os.path.join(PARENT_PATH, 'bar')
os.rmdir(CHILD_PATH)
num_retries = 0
t0 = time.perf_counter()
while True:
try:
os.rmdir(PARENT_PATH)
break
except OSError as e:
if e.winerror != ERROR_DIR_NOT_EMPTY:
raise
num_retries += 1
wait_time = time.perf_counter() - t0
print('num_retries:', num_retries)
print('wait_time:', wait_time)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33240>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com