similar to: connections: remember to close it!

Displaying 20 results from an estimated 4000 matches similar to: "connections: remember to close it!"

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
2007 May 30
5
Possible changes to connections
When I originally implemented connections in R 1.2.0, I followed the model in the 'Green Book' closely. There were a number of features that forced a particular implementation, and one was getConnection() that allows one to recreate a connection object from a number. I am wondering if anyone makes use of this, and if so for what? It would seem closer to the R philosophy to have
2002 Feb 14
1
immortal connections
I have several data input functions that include a construct like the following: indat <- function(stuff) { [...] awkp <- paste("awk ...yada yada...", stuff, etc.) scan(pipe(awkp),quiet=TRUE) } I use these functions a lot, and as I do, a lengthening list of closed, but undestroyed, connections accumulates. Ultimately this appears to stuff things up and cause
2002 Feb 28
2
Failed file("foo", "r") keeps file open? (PR#1333)
Full_Name: Henrik Bengtsson Version: R v1.4.0 OS: Solaris 8 Submission from: (NULL) (130.235.3.49) When I am trying the following on Rv1.4.0 on Solaris 8, I get that the "cannot close output sink connection": % R --vanilla tmpfile <- tempfile() # Create a filename that does not exist for(k in 1:100) { cat(k, ": "); try(fh <- file(tmpfile, "r"))
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
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) >
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
2010 Dec 13
1
errors in getconnection or scan
I was wondering if there was a function like "does connection exists" ? I am currently using loops to build up a database, and I have either > B = getConnection(localization) Error in getConnection(localization) : there is no connection -2147483648 In addition: Warning message: In getConnection(localization) : NAs introduced by coercion or > B = scan(localization) Error in
2012 Feb 12
3
Writing output into a file
Hi everyone, I'm an R newbie working with the poLCA module. I achieved my target without having to bother anyone, but It seems that I've got stuck at the last minute. My problem is simple. I need to write my results into a file. My results are in the shape of a list (unbalanced columns) I've considered several methods (sink(), write.file) etc. etc. Unfortunately, I'm not the best
2002 Jan 10
1
Closing binary file connections
Hi all, I'm writing a function that read data from a binary file. I want to close all opened connections, but it failed: > showConnections() description class mode text isopen can read can write 3 "daten/t5_all.mea" "file" "rb" "binary" "opened" "yes" "no" 4 "daten/t5_all.mea"
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
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: ?
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
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
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
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
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 Nov 07
1
getConnection, R_outpstream_st
Hello, I'm trying to use the limited connections api defined in Rinternals.h. I have code that looks like this (inspired from do_serializeToConn) : SEXP serialize_to_connection( SEXP xp, SEXP connection ){ Rconnection con ; struct R_outpstream_st out; R_pstream_format_t type = R_pstream_binary_format ; SEXP (*hook)(SEXP, SEXP) = NULL ; con = getConnection(Rf_asInteger(connection));
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
2012 Oct 04
1
Intermittent connectivity issues for JDBC / Oracle
I have been experiencing issues with an R script hanging when connecting to an Oracle database. To help debug, I found a function here in the nabble forum and made a small test script: #!/usr/bin/Rscript --no-restore --no-save --no-init-file library("RJDBC") drv<-JDBC("oracle.jdbc.OracleDriver","/home/oracle/lib/ojdbc6.jar", "'") dbCheck =