Skip to content
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
Closed

read_fwf on empty file throws error #441

antoine-sachet opened this issue Jun 21, 2016 · 0 comments
Assignees
Labels
bug an unexpected problem or unintended behavior

Comments

@antoine-sachet
Copy link

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 an unexpected problem or unintended behavior label Jul 6, 2016
jimhester added a commit to jimhester/readr that referenced this issue 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.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants