[R] WG: Re: source and localhost

Thomas.Bock at ptb.de Thomas.Bock at ptb.de
Fri May 20 18:04:00 CEST 2011


> 
> Re: [R] source and localhost
> 
> On Fri, 20 May 2011, Uwe Ligges wrote:
> 
> >
> >
> > 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.R
> >
> > Does
> >
> > 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..
> 
> Correct, but ?file says
> 
>       For ‘file’ the description is a path to the file to be opened or a
>       complete URL (when it is the same as calling ‘url’), ...
> 
> so this works in principle (and in practice for me: 
> source("http://www.stats.ox.ac.uk/~ripley/APTS2010/slice.R") ). So the 
> issue is something peculiar to the URL. Maybe try download.file on it 
> with options(internet.info=0) to get maximal info.
this            ^^^^^^^
was a good idea; It shows, that I have to specify no_proxy somehow 
(source() tries to find localhost over our proxy). 
I think source don't care about:

Sys.getenv("no_proxy")
> [1] "localhost, 127.0.0.1" 

How can I specify no_proxy for source? 

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:
> >> 
> >>> 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
> >> 



More information about the R-help mailing list