diff options
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index f7cde270d..44a91c0c7 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1274,8 +1274,10 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, first_line = asbytes('').join(first_line.split(comments)[1:]) first_values = split_line(first_line) except StopIteration: - # might want to return empty array instead of raising error. - raise IOError('End-of-file reached before encountering data.') + # return an empty array if the datafile is empty + first_line = '' + first_values = [] + warnings.warn('genfromtxt: Empty input file: "%s"' % fname) # Should we take the first values as names ? if names is True: |