search for: isopen

Displaying 20 results from an estimated 62 matches for "isopen".

2006 Mar 25
2
R gets slow
...ks well (fast). I don't know if I have to free the memory or something. Here you have the code: R server: FSsocket <- function(){ continue = TRUE; while(continue){ conn <- try(socketConnection(server = TRUE, port = 7890, blocking = TRUE, open = "ab"), silent = FALSE); isOpened = !inherits(conn, "try-error"); isOpened = isOpened && isOpen(conn); while(!isOpened){ Sys.sleep(1); conn <- try(socketConnection(server = TRUE, port = 7890, blocking = TRUE, open = "ab"), silent = FALSE); isOpened = !inherits(conn, "try-error&...
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 'g...
2014 Jun 19
1
isOpen() misbehaviour
Hello, >From the doc, it says: "isOpen returns a logical value, whether the connection is currently open." But actually it seems to die on closed connections: > con <- file() > isOpen(con) [1] TRUE > close(con) > isOpen(con) Error in isOpen(con) : invalid connection Is it expected ? Tested on R-3.0.2 and R version...
2009 May 21
3
file descriptor leak in getSrcLines in R 2.10.0 svn 48590
...ooks like it happens in as.character.srcref's call to getSrcLines, which has some logic I don't understand about closing 'srcfile' on exit only if !.is.Open(srcfile): > getSrcLines function (srcfile, first, last) { if (first > last) return(character(0L)) if (!.isOpen(srcfile)) on.exit(close(srcfile)) conn <- open(srcfile, first) lines <- readLines(conn, n = last - first + 1L, warn = FALSE) srcfile$line <- first + length(lines) return(lines) } (It looks like the srcref stuff is not finished yet, as there are other problems, like...
2009 Jul 21
1
Checking on closed file connections
Hi! I'm wondering if there's a smart way around this: fileName= (some valid file on your system) > fileCon=file(fileName, open="rt") > l<-readLines (fileCon, n= 1) > > isOpen(fileCon) [1] TRUE > close(fileCon) > isOpen(fileCon) Error in isOpen(fileCon) : invalid connection How do you test for a file being closed if isOpen gives you an error message? Thanks! -Jim
2011 Apr 08
1
Invalid connection after closing?
Dear all, I do not completely understand following behaviour : > con <- file("test.txt") > isOpen(con) [1] FALSE > open(con) > isOpen(con) [1] TRUE > close(con) > isOpen(con) Error in isOpen(con) : invalid connection > str(con) Classes 'file', 'connection' atomic [1:1] 3 ..- attr(*, "conn_id")=<externalptr> Why do I get an error, indicating an...
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 can read can write 3 "tempfile"...
2017 Dec 14
4
cannot destroy connection (?) created by readLines in a tryCatch
...> >> showConnections(all = TRUE) > > description > > 0 "stdin" > > 1 "stdout" > > 2 "stderr" > > 3 > "/var/folders/79/l_n_5qr152d2d9d9xs0591lh0000gn/T//RtmpZRcxmh/file128a13bffc77" > > class mode text isopen can read can write > > 0 "terminal" "r" "text" "opened" "yes" "no" > > 1 "terminal" "w" "text" "opened" "no" "yes" > > 2 "terminal" "w&...
2006 Oct 09
1
Discussion starter for package level Connection API
...hen there's the PushBack members, to which the user would have full access. Looks like they're only used in text connections. Would these be better off placed in the private member structure? Also, the user has the capability to call close on the connection without updating the original isopen member. Here's a rather restrictive approach whereby the user must know the integer index of the connection. Each function is a wrapper around the related Rconnection member. int R_VfprintfConnection(int idx, const char *format, va_list ap){ Rconnection con = getConnection(idx);...
2018 Oct 31
1
PATCH: Asserting that 'connection' used has not changed + R_GetConnection2()
...Bengtsson/Wishlist-for-R/issues/81). BACKGROUND: In R, connections are indexed by their (zero-based) row indices in the table of available connections. For example, > fh <- file("a.txt", open = "w") > showConnections(all = TRUE) description class mode text isopen can read can write 0 "stdin" "terminal" "r" "text" "opened" "yes" "no" 1 "stdout" "terminal" "w" "text" "opened" "no" "yes" 2 "stderr&qu...
2000 Dec 20
0
showConnections() does not show closed (or non-opened) connections though help says so (PR#784)
...f false only open user-created connections are included. but > # create a file > cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file="ex.data", + sep="\n") > showConnections(all=TRUE) class description mode text isopen can read can write 0 "stdin" "terminal" "r" "text" "opened" "yes" "no" 1 "stdout" "terminal" "w" "text" "opened" "no" "yes" 2 "stde...
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
2000 Dec 20
1
showConnections() does not show closed (or non-opened) connections though help says so
...f false only open user-created connections are included. but > # create a file > cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file="ex.data", + sep="\n") > showConnections(all=TRUE) class description mode text isopen can read can write 0 "stdin" "terminal" "r" "text" "opened" "yes" "no" 1 "stdout" "terminal" "w" "text" "opened" "no" "yes" 2 "stde...
2017 Dec 14
2
cannot destroy connection (?) created by readLines in a tryCatch
...connection you cannot close(), i.e. the last showConnections() call prints: ? showConnections(all = TRUE) description 0 "stdin" 1 "stdout" 2 "stderr" 3 "/var/folders/59/0gkmw1yj2w7bf2dfc3jznv5w0000gn/T//Rtmpc7JqVS/filecc2044b2ccec" class mode text isopen can read can write 0 "terminal" "r" "text" "opened" "yes" "no" 1 "terminal" "w" "text" "opened" "no" "yes" 2 "terminal" "w" "text" "...
2005 Apr 14
2
documentation for 'open': some clarification?
...that can be parsed line by line (using readLines() or scan() to read). But open() cannot be directly applied to a file name. In fact, one only needs supply the 'open' argument in file() with something other than the empty string, ,---- | > con <- file ("S200.dat") | > isOpen (con) | [1] FALSE | > con <- file ("S200.dat", open = "r") | > isOpen (con) | [1] TRUE `---- It is not clear to me how 'open()' is supposed to be used. It took me a while to figure this out and I thought it might be worthwhile to add one sentence or two to mak...
2017 Dec 14
0
cannot destroy connection (?) created by readLines in a tryCatch
...rn=FALSE), error=function(x) NA) [1] NA *Warning message:* *In file(con, "r") :* * cannot open file '/var/folders/79/l_n_5qr152d2d9d9xs0591lh0000gn/T//RtmpzIZ6Qh/file1ed2e57f2ea': No such file or directory* > showConnections(all=TRUE) description class mode text isopen can read can write 0 "stdin" "terminal" "r" "text" "opened" "yes" "no" 1 "stdout" "terminal" "w" "text" "opened" "no" "yes" 2 "stderr...
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
2016 Nov 13
1
Memory leak with tons of closed connections
...mode); + fp = fdopen(dup(0), con->mode); #else warning(_("cannot open file '%s': %s"), name, "fdopen is not supported on this platform"); @@ -633,8 +633,7 @@ static void file_close(Rconnection con) { Rfileconn this = con->private; - if(con->isopen && strcmp(con->description, "stdin")) - con->status = fclose(this->fp); + con->status = fclose(this->fp); con->isopen = FALSE; #ifdef Win32 if(this->anon_file) unlink(this->name); On Fri, Nov 11, 2016 at 1:12 PM, G?bor Cs?rdi <csardi.gabor...
2005 Feb 01
2
assign connections automatically
....txt") # grab only *.txt files + fn2 <- gsub('.txt', "", fn) # removes the '.txt' from each string + for(i in 1:length(fn)) + assign((fn2[[i]]),file(fn[i], open="r")) + } > showConnections() #currently, no connections description class mode text isopen can read can write > inConnect() # run function > showConnections() #the connections are now there description class mode text isopen can read can write 3 "testx.txt" "file" "r" "text" "opened" "yes" "no"...
2000 Dec 20
1
unlink() is not synchronized with existing connections
> # 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 can read can write 3 "tempfile"...