New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_fwf on empty file throws error #441

Closed
antoine-sachet opened this Issue Jun 21, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@antoine-sachet

antoine-sachet commented Jun 21, 2016

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.

@jimhester jimhester added the bug label Jul 6, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 6, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 6, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 7, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 7, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 7, 2016

@jimhester jimhester removed the in progress label Jul 7, 2016

@lock lock bot locked and limited conversation to collaborators Sep 25, 2018

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