Ignore:
Timestamp:
Dec 19, 2018, 7:31:27 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
0770148, cb0d7d0
Parents:
34d4232 (diff), 0045668 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/pitchshift

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/utils.py

    r34d4232 rd0f19a7  
    99
    1010def array_from_text_file(filename, dtype = 'float'):
    11     filename = os.path.join(os.path.dirname(__file__), filename)
    12     with open(filename) as f:
    13         lines = f.readlines()
    14     return np.array([line.split() for line in lines],
    15             dtype = dtype)
     11    realpathname = os.path.join(os.path.dirname(__file__), filename)
     12    return np.loadtxt(realpathname, dtype = dtype)
    1613
    1714def list_all_sounds(rel_dir):
     
    3936        os.unlink(path)
    4037    except WindowsError as e:
    41         print("deleting {:s} failed ({:s}), reopening".format(path, repr(e)))
    42         with open(path, 'wb') as f:
    43             f.close()
    44         try:
    45             os.unlink(path)
    46         except WindowsError as f:
    47             print("deleting {:s} failed ({:s}), aborting".format(path, repr(e)))
     38        # removing the temporary directory sometimes fails on windows
     39        import warnings
     40        errmsg = "failed deleting temporary file {:s} ({:s})"
     41        warnings.warn(UserWarning(errmsg.format(path, repr(e))))
    4842
    4943def array_from_yaml_file(filename):
Note: See TracChangeset for help on using the changeset viewer.