Changeset 65628c4 for python/tests/utils.py
- Timestamp:
- Dec 19, 2018, 9:50:33 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
- Children:
- f56f795
- Parents:
- d64f56d (diff), 5573a6b (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/utils.py
rd64f56d r65628c4 9 9 10 10 def 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) 16 13 17 14 def list_all_sounds(rel_dir): … … 39 36 os.unlink(path) 40 37 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)))) 48 42 49 43 def array_from_yaml_file(filename):
Note: See TracChangeset
for help on using the changeset viewer.