Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/utils.py

    r5d8cc71 ra3f2695  
    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.