Duncan Murdoch
2017-Aug-09 13:01 UTC
[R] Problem with serialization via readRDS() on a textConnection()
(Sorry for not linking to your message; I accidentally deleted the original copy of your message.) Your code > zz = textConnection('tempConnection', 'wb') > saveRDS(c("a", "b", "c"), zz, ascii = TRUE) > serialized_obj = paste(textConnectionValue(zz), collapse='\n') > readRDS(textConnection(serialized_obj)) Error in gzcon(file) : 'read' not enabled for this connection has one problem: textConnectionValue(zz) may not be the complete text because zz hasn't been closed. You should close(zz), then get the result from the variable tempConnection. However, this doesn't fix the problem you saw, which appears to be a bug in readRDS or gzcon. I'll post it to the bug list. Duncan Murdoch
Duncan Murdoch
2017-Aug-09 13:06 UTC
[R] Problem with serialization via readRDS() on a textConnection()
On 09/08/2017 9:01 AM, Duncan Murdoch wrote:> (Sorry for not linking to your message; I accidentally deleted the > original copy of your message.) > > Your code > > > zz = textConnection('tempConnection', 'wb') > > saveRDS(c("a", "b", "c"), zz, ascii = TRUE) > > serialized_obj = paste(textConnectionValue(zz), collapse='\n') > > readRDS(textConnection(serialized_obj)) > Error in gzcon(file) : 'read' not enabled for this connection > > has one problem: textConnectionValue(zz) may not be the complete text > because zz hasn't been closed. You should close(zz), then get the > result from the variable tempConnection. > > However, this doesn't fix the problem you saw, which appears to be a bug > in readRDS or gzcon. I'll post it to the bug list.Now posted as https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17325. Duncan Murdoch
Possibly Parallel Threads
- Problem with serialization via readRDS() on a textConnection()
- How to benchmark speed of load/readRDS correctly
- Memory error in the libcurl connection code
- [FORGED] recordPlot/replayPlot not working with saveRDS/readRDS
- Risk of readRDS() not detecting race conditions with parallel saveRDS()?