def _removeSafely(path):
    if not path.child('_trial_marker').exists():
        raise _NoTrialMarker(
            '%r is not a trial temporary path, refusing to remove it'
            % (path,))
    try:
        path.remove()
    except OSError, e:
        print ("could not remove %r, caught OSError [Errno %s]: %s"
               % (path, e.errno, e.strerror))
        try:
            newPath = FilePath('_trial_temp_old%s' % (randrange(1000000),))
            path.moveTo(newPath)
        except OSError, e:
            print ("could not rename path, caught OSError [Errno %s]: %s"
                   % (e.errno,e.strerror))
            raise
Safely remove a path, recursively.
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/trial/util.py/_removeSafely