From: Paul Brossier Date: Mon, 16 May 2016 04:09:38 +0000 (+0200) Subject: python/tests/utils.py: try reopening the file is deleting it fails on windows X-Git-Tag: 0.4.4~300^2~12 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=3c4fb67a2de8471c1e63edfff8d69451f0296f76;p=aubio.git python/tests/utils.py: try reopening the file is deleting it fails on windows --- diff --git a/python/tests/utils.py b/python/tests/utils.py index 4e4ac71d..2e3c31e5 100644 --- a/python/tests/utils.py +++ b/python/tests/utils.py @@ -29,7 +29,16 @@ def get_tmp_sink_path(): return path def del_tmp_sink_path(path): - os.unlink(path) + try: + os.unlink(path) + except WindowsError as e: + print("deleting {:s} failed ({:s}), reopening".format(path, repr(e))) + with open(path, 'wb') as f: + f.close() + try: + os.unlink(path) + except WindowsError as f: + print("deleting {:s} failed ({:s}), aborting".format(path, repr(e))) def array_from_yaml_file(filename): import yaml