This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, giampaolo.rodola, paul.moore, steve.dower, tarek, tim.golden, yuliu, zach.ware
Date 2018-04-09.02:41:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523241712.26.0.682650639539.issue33240@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2018-04-09 02:41:52eryksunsetrecipients: + eryksun, paul.moore, giampaolo.rodola, tim.golden, tarek, zach.ware, steve.dower, yuliu
2018-04-09 02:41:52eryksunsetmessageid: <1523241712.26.0.682650639539.issue33240@psf.upfronthosting.co.za>
2018-04-09 02:41:52eryksunlinkissue33240 messages
2018-04-09 02:41:51eryksuncreate