[R] ReadLines does not give results with urls
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jan 12 18:12:19 CET 2004
It is not readLines() that does not work but url(). Have you tried
looking at the increased level of output which is available to see why?
It is described under ?download.file and ?option, option "internet.info".
We can't tell from your diagnostics if no_proxy is set but empty or unset.
It does have to be unset and I believe SuSe systems have a habit of having
it set but empty.
On Mon, 12 Jan 2004, Luzie U. Wingen wrote:
> Hello,
>
> I am using R version 1.8.1 on a linux machine (Suse 8.2.).
> I have problems to use readLines() with urls.
>
> This seems to be a problem with our proxy-server.
> Downloading files work with download.file() with wget but not without:
>
> > download.file(url = "http://cran.r-project.org/src/contrib/PACKAGES", destfile = "test.txt", method = "wget", cacheOK = FALSE)
> This works!
>
> > download.file(url = "http://cran.r-project.org/src/contrib/PACKAGES", destfile = "test.txt", cacheOK = FALSE)
> This does not work!
>
> For readLines() there seems not to be the possibility to use wget.
> So I can only read the local pages which are accessible without proxy-server
> but not:
>
> > readLines(url("http://cran.r-project.org/src/contrib/PACKAGES"))
> This does give the following response after 60 sec:
> >Error in readLines(url("http://cran.r-project.org/src/contrib/PACKAGES"), :
> cannot open the connection
> >In addition: Warning message:
> >unable to connect to 'cran.r-project.org' on port 80.
>
> After reading the help pages I checked the http_proxy environmental
> variable, which seems to be OK to me:
>
> > Sys.getenv("http_proxy")
> http_proxy
> "http://proxy.mh-hannover.de:8080/"
> > Sys.getenv("no_proxy")
> no_proxy
> ""
>
> Setting the options options(download.file.method="wget") helps
> for download.file() but not for "readLines().
>
> Does anybody has a further idea, how to manipulate readLines()
> so that it uses the proxy-server?
>
> Thank you
>
> Luzie
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list