Dear List, I have problems with the function source() using a url of the kind: http://localhost:5984/path/fn.R I receive Fehler in file(file, "r", encoding = encoding) : kann Verbindung nicht ?ffnen Zus?tzlich: Warnmeldung: In file(file, "r", encoding = encoding) : ?ffnen fehlgeschlagen: HTTP Status war '502 cannotconnect' The url itself is ok since I can: - use a browser - use curl - use download.file() function - use getURL() (out of Duncans RCurl) furthermore it works, when I use the full host + domain name. So I think it is about dns stuff. I get a nice:> Sys.getenv("no_proxy")[1] "localhost, 127.0.0.1" and work on 32bit opensuse 11.4 with R version 2.13.0 (2011-04-13) Can someone give me a hint? Best regards Thomas
On 20.05.2011 17:22, Thomas.Bock at ptb.de wrote:> Dear List, > > I have problems with the function source() using a > url of the kind: > > http://localhost:5984/path/fn.RDoes con <- url("http://localhost:5984/path/fn.R") source(url) close(con) work for you? Please read ?source carefully and note it uses a file() connection as the default unless you specify another connection explicitly.. Uwe Ligges> I receive > > Fehler in file(file, "r", encoding = encoding) : > kann Verbindung nicht ?ffnen > Zus?tzlich: Warnmeldung: > In file(file, "r", encoding = encoding) : > ?ffnen fehlgeschlagen: HTTP Status war '502 cannotconnect' > > The url itself is ok since I can: > - use a browser > - use curl > - use download.file() function > - use getURL() (out of Duncans RCurl) > > furthermore it works, when I use the full host + domain name. > So I think it is about dns stuff. I get a nice: > >> Sys.getenv("no_proxy") > [1] "localhost, 127.0.0.1" > > and work on 32bit opensuse 11.4 with > R version 2.13.0 (2011-04-13) > > Can someone give me a hint? > Best regards > Thomas > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Thomas, your example works with R-2.13.0 and Apache running on Gentoo. You may try to use "http://127.0.0.1:5984/path/fn.R", just to exclude that this problem has anything to do with name resolution. Best Hugo> Dear List, > > I have problems with the function source() using a > url of the kind: > > http://localhost:5984/path/fn.R > > I receive > > Fehler in file(file, "r", encoding = encoding) : > kann Verbindung nicht ?ffnen > Zus?tzlich: Warnmeldung: > In file(file, "r", encoding = encoding) : > ?ffnen fehlgeschlagen: HTTP Status war '502 cannotconnect' > > The url itself is ok since I can: > - use a browser > - use curl > - use download.file() function > - use getURL() (out of Duncans RCurl) > > furthermore it works, when I use the full host + domain name. > So I think it is about dns stuff. I get a nice: > > > Sys.getenv("no_proxy") > [1] "localhost, 127.0.0.1" > > and work on 32bit opensuse 11.4 with > R version 2.13.0 (2011-04-13) > > Can someone give me a hint? > Best regards > Thomas > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
"localhost" is the computer you are working at, and the ip assigned to the loob-back interface. This is normally used for testing networking interfaces. That being so, simply using the path to the file on your machine, e.g. "/home/<username>/data/somedata.csv" should work much better. JWD
...> > As Uwe told you, it is not source(), it is file(). > > Please read the documentation for yourself.ok; done! ?file links to ?download.file(). here one can read, that the proxy (and I guess the no_proxy) have to be specified via environment variables. As I showed in my initial mail 1) the no_proxy variable is set; However it is not used leading to 502... Any further hints? Regards Thomas> > > > > Thank you very much! > > Thomas > >> > >>> > >>> Uwe Ligges > >>> > >>> > >>> > >>> > >>>> I receive > >>>> > >>>> Fehler in file(file, "r", encoding = encoding) : > >>>> kann Verbindung nicht ?ffnen > >>>> Zus?tzlich: Warnmeldung: > >>>> In file(file, "r", encoding = encoding) : > >>>> ?ffnen fehlgeschlagen: HTTP Status war '502 cannotconnect' > >>>> > >>>> The url itself is ok since I can: > >>>> - use a browser > >>>> - use curl > >>>> - use download.file() function > >>>> - use getURL() (out of Duncans RCurl) > >>>> > >>>> furthermore it works, when I use the full host + domain name. > >>>> So I think it is about dns stuff. I get a nice: > >>>>1)> >>>>> Sys.getenv("no_proxy") > >>>> [1] "localhost, 127.0.0.1" > >>>> > >>>> and work on 32bit opensuse 11.4 with > >>>> R version 2.13.0 (2011-04-13) > >>>> > >>>> Can someone give me a hint? > >>>> Best regards > >>>> Thomas