Skip to content

read_fwf on empty file throws error #441

Description

@antoine-sachet

Hi,

read_fwf on an empty file throws this (Windows-specific I think) error message:
Error: Cannot read file xxx: The volume for a file has been externally altered so that the opened file is no longer valid.

Note that this is a new behaviour: before I installed the latest readr version, the error was simply Cannot read file xxx.

I have the latest readr from github (re-installed minutes ago) and I work with R version 3.2.3 on Windows 7.

To reproduce:

library("readr")
# create an empty file in working dir
write_csv(data.frame(), "emptyFile")
# this line fails
read_fwf("emptyFile", col_positions=fwf_widths(1))

This is similar to this issue, which has been solved by returning empty structures when the file was empty. I suggest to extend the fix to read_fwf.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions