raise TypeError or ValueError if fname is None or empty str, respectively