Displaying 20 results from an estimated 6000 matches similar to: "Closing binary file connections"
2007 Jul 03
1
bug in closing gzfile-opened connections?
Hi,
I am making multiple calls to gzfile() via read.table(), e.g.
> x <- read.table( gzfile( "xxx.gz" ) )
After i do this many times (I haven't counted, but probably between 50 and
100 times) I get the error message:
Error in open.connection(file, "r") : unable to open connection
In addition: Warning message:
cannot open compressed file 'xxx.gz'
however, I
2009 May 21
3
file descriptor leak in getSrcLines in R 2.10.0 svn 48590
I noticed the following file descriptor leak when I couldn't remove
a package unless I shut down the R session that had loaded and
used it. The function that triggered the problem printed the output
of a call to parse(). Each time one prints a srcref a connection is
opened and not closed. It looks like it happens in
as.character.srcref's
call to getSrcLines, which has some logic I
2002 Oct 04
1
Getting rid of extra connections?
I'm trying to figure out how to get out of this situation:
> source('monit.r')
Error in file(file, "r") : All connections are in use
> showConnections()
description class mode text isopen can read can write
> help.search('connection')
Error in file(file, "r") : All connections are in use
> q()
Save workspace image? [y/n/c]: y
Error
2006 May 26
2
Too many open files
This may be more of an OS question ...
I have this call
r = get.hist.quote(symbol, start= format(start, "%Y-%m-%d"), end=
format(end, "%Y-%m-%d"))
which does a url request
in a loop and my program runs out of file handlers after few hundred
rotations. The error message is: 'Too many open files'. Other than
increasing the file handlers assigned to my process, is there
2000 Dec 20
1
unlink() is not synchronized with existing connections (PR#783)
> # creating a file
> cat("sddfasdf", file="tempfile")
> showConnections()
class description mode text isopen can read can write
> con <- file("tempfile", "r")
> readLines(con)
[1] "sddfasdf"
Warning message:
incomplete final line in: readLines(con, n, ok)
> showConnections()
class description mode text isopen
2017 Dec 14
4
cannot destroy connection (?) created by readLines in a tryCatch
On Thu, Dec 14, 2017 at 7:56 PM, Gabriel Becker <gmbecker at ucdavis.edu> wrote:
> Gabor,
>
> You can grab the connection and destroy it via getConnection and then a
> standard close call.
Yeah, that's often a possible workaround, but since this connection
was opened by
readLines() internally, I don't necessarily know which one it is. E.g.
I might open multiple
2017 Dec 14
2
cannot destroy connection (?) created by readLines in a tryCatch
Consider this code. This is R 3.4.2, but based on a quick look at the
NEWS, this has not been fixed.
tryCatch(
readLines(tempfile(), warn = FALSE)[1],
error = function(e) NA,
warning = function(w) NA
)
rm(list=ls(all.names = TRUE))
gc()
showConnections(all = TRUE)
If you run it, you'll get a connection you cannot close(), i.e. the
last showConnections() call prints:
?
2018 Oct 31
1
PATCH: Asserting that 'connection' used has not changed + R_GetConnection2()
SUMMARY:
I'm proposing that R assert that 'connection' options have not changed
since first created such that R will produce the following error:
> fh <- file("a.txt", open = "w+")
> cat("hello\n", file = fh)
> close(fh)
> fh2 <- file("b.txt", open = "w+")
> cat("world\n", file = fh2)
>
2001 Dec 11
1
Using lib Rstreams and gzfile()
Hi all,
in the last time I've intensively used Rstreams to read and write from
binary files. Now I'm wondering if it is possible to use Rsteams
functions with gzipped files. But I haven't found the trick:
> p1c.gzip <- gzfile("daten/p1c_all.mea.gz", open="rb")
> readBin(p1c.gzip, integer(), n=64,size=2)
[1] 84 1 400 1 749 0 0 0
2007 Nov 14
1
isOpen on closed connections
As far as I can tell, 'isOpen' cannot return FALSE in the case when 'rw = ""'.
If the connection has already been closed by 'close' or some other function,
then isOpen will produce an error. The problem is that when isOpen calls
'getConnection', the connection cannot be found and 'getConnection' produces an
error. The check to see if it is
2005 Feb 01
2
assign connections automatically
Hi all,
I am trying to create a function that will open connections to all
files of
one type within the working directory.
I've got the function to open the connections, but I am having a
bugger of a
time trying to get these connections named as objects in the workspace.
I am at the point where I can do it outside of the function, but not
inside, using assign. I'm sure I'm
2017 Dec 15
1
cannot destroy connection (?) created by readLines in a tryCatch
Thanks for tracking this down. Yeah, I should use suppressWarnings(),
you are right.
Although, readLines() might throw another warning, e.g. for incomplete
last lines,
and you don't necessarily want to suppress that.
TBH I am not sure why that warning is given:
? con <- file(tempfile())
? open(con)
Error in open.connection(con) : cannot open the connection
In addition: Warning message:
In
2006 Nov 02
3
CRAN task views work only once per session (PR#9330)
Cran task views seems to be a "once-per-session" process -- the first
attempt to access views in a (RGui for Windows) session works, but
subsequent attempts fail. There is a noticeably long pause before
the failing call returns.
Example session with two calls to "available.views" follows, but similar
effects have been observed with two calls to "install.views" and
2013 Jun 19
2
Ryacas loads but yacas has an error
Hello yet again, R People:
I was working with Ryacas and yacas last night and all was well.
Now this morning, I keep getting the following:
> a <- Sym("a")
> a
Error in summary.connection(x) : invalid connection
>
When I go to yacas from the command line, it works fine.
Any suggestions, please?
I'm thinking that a port might be open, but here I have:
>
2005 Jun 29
2
"all connections are in use" error during lazyload stage of packa ge installation
Hi,
I suddenly started getting strange errors while working on my caTools
package:
>RCMD install C:/programs/R/rw2011/src/library/caTools
......
preparing package caTools for lazy loading
Error in file(file, "r", encoding = encoding) :
all connections are in use
Execution halted
make: *** [lazyload] Error 1
*** Installation of caTools failed ***
I searched
2009 May 16
2
newbie: closing unused connection + readline
Hello;
I am new to R and trying to read a line from socket connection at a
time but at the end of script I am getting "closing unused connection"
warning. I am not able to understand how to solve this. I want to read
a line from socket and then use read.table/scan on that line but it
looks like I am opening multiple connections instead of just one. I
think I am doing something wrong or
2009 Jul 18
1
[R] Problem With Repeated Use Of Load/Save/Close Commands (PR#13841)
On 17/07/2009 7:57 PM, Marilyn & Rich Short wrote:
> Hello,
>
> I'm having a problem in R with repeated use of the "load", "save", and
> "close" commands. I'm getting an error message that reads, "Too many
> open files". I'm opening files and closing them (and unlinking them),
> but when I go through that process 509
2009 Jul 17
1
Problem With Repeated Use Of Load/Save/Close Commands
Hello,
I'm having a problem in R with repeated use of the "load", "save", and
"close" commands. I'm getting an error message that reads, "Too many
open files". I'm opening files and closing them (and unlinking them),
but when I go through that process 509 times, the program halts and I
get this error message: "cannot open the
2001 Oct 02
1
connections: remember to close it!
Hi all,
I have newly discovered the power of connections (although just a small part
of it, namely the file() connection). It allowed me to process data file
with arbitrary number of fields per line, which I was using awk for
preprocessing before readling into R. The combination of the connection,
readLines() and strsplit() really make the work a lot easier and more
organized. Thanks a bundle
2011 Aug 18
1
problems with connections when applied in tryCatch
Recently on stackoverflow following problem came up :
http://stackoverflow.com/questions/7103429/all-the-connections-are-in-use-execution-halted/7108799#7108799
A reproducible example: When trying
replicate(200,tryCatch(read.table("this.is.no.file"),
warning=function(w){print(showConnections());print("warning")}))
No connections are shown, but after a number of