You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded to readr version 2.0. When I did this, I ran in to some problems with older scripts. I worked out, the problem was that if I read a csv using readr::read_csv and then rewrote the object to a file using readr::write_csv, the file would become corrupted in some way.
In particualr, when writing the file, I would get the error:
Cannot open the file for writing
When I went to try and reopen the file in Excel, it would open without a problem, but when trying to modify and save the file, I would receive the error:
Can not be accessed. The file may be corrupted located on a server that is not responding
This is an example of code that would produce this type of error:
# The process was simplydf<-data.frame(read_csv("filename.csv",na=c('n/a','<NA>','NA')))
write_csv(df,"filename.csv")
I am using windows 10 (64-bit) and R version 4.1.0.
In the end I switched back to version 1.4 and everything works again.
Let me know if you need any more details :)
(By the way this is not a complaint at all, I love this package, just thought I would point this out in case it helpful!)
The text was updated successfully, but these errors were encountered:
With lazy reading a file handle remains open until the whole file has been read. On Windows if any process has an open file handle to a file it is locked and nothing else can write to it.
Use lazy=FALSE when reading the file, and then no file handle will remain open and what you are trying to do will work.
Hi all!
I recently upgraded to readr version 2.0. When I did this, I ran in to some problems with older scripts. I worked out, the problem was that if I read a csv using
readr::read_csv
and then rewrote the object to a file usingreadr::write_csv
, the file would become corrupted in some way.In particualr, when writing the file, I would get the error:
Cannot open the file for writing
When I went to try and reopen the file in Excel, it would open without a problem, but when trying to modify and save the file, I would receive the error:
Can not be accessed. The file may be corrupted located on a server that is not responding
This is an example of code that would produce this type of error:
I am using windows 10 (64-bit) and R version 4.1.0.
In the end I switched back to version 1.4 and everything works again.
Let me know if you need any more details :)
(By the way this is not a complaint at all, I love this package, just thought I would point this out in case it helpful!)
The text was updated successfully, but these errors were encountered: