Tony Breyal
2009-Jun-02 11:09 UTC
[R] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host
Dear all, I am having a problem downloading webpages through R when i run it in the DOS window under Windows Vista Basic. I have downloaded the batchfiles from http://code.google.com/p/batchfiles/ and have successfully set the PATH. I open up 'Command Prompt' in Vista and type (after the C:\...> stuff): ### START ### C:\Users\Karen>Rscript -e "library(RCurl); getURL('http:// www.google.com')" Loading required package: methods Loading required package: bitops Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) : couldn't connect to host Calls: getURL -> curlPerform -> .Call Execution halted ### END ### I think this means that R could not connect to the internet. However, if i run the same code in Rgui (i.e. opening R normally, not command line) then this code works correctly. Also, on my other computer which runs Windows Vista Ultimate, the command line version works correctly and downloads the webpage. I need to get this to work because i need to do some web crawls in batch mode using R. Any help would be most appreciated. Thank you kindly for your time in advance, Tony Breyal> sessionInfo()R version 2.9.0 (2009-04-17) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom. 1252;LC_MONETARY=English_United Kingdom. 1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices datasets utils methods base other attached packages: [1] RCurl_0.95-1 rcom_2.1-3 rscproxy_1.3-1 loaded via a namespace (and not attached): [1] tools_2.9.0
Gabor Grothendieck
2009-Jun-02 15:52 UTC
[R] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host
On Tue, Jun 2, 2009 at 7:09 AM, Tony Breyal <tony.breyal at googlemail.com> wrote:> Dear all, > > I am having a problem downloading webpages through R when i run it in > the DOS window under Windows Vista Basic. I have downloaded the > batchfiles from http://code.google.com/p/batchfiles/ and have > successfully set the PATH.You don't need to set your PATH if you use batchfiles. Their purpose is avoid having to do that in the first place. That may not be related to your main problem though.> > I open up 'Command Prompt' in Vista and type (after the C:\...> > stuff): > > ### START ### > C:\Users\Karen>Rscript -e "library(RCurl); getURL('http:// > www.google.com')" > Loading required package: methods > Loading required package: bitops > Error in curlPerform(curl = curl, .opts = opts, .encoding > = .encoding) : > ?couldn't connect to host > Calls: getURL -> curlPerform -> .Call > Execution halted > ### END ###Here are two things to try: 1. Just a guess but you may need to run this elevated. Using el.js from the batchfiles: el cmd and allow it to proceed when asked. That will spawn a new window from which everything will run in elevated mode. Try your Rscript command in that. 2. Another thing to try is running without using the batchfiles. Go into R and enter this: file.path(R.home(), "bin", "Rscript.exe") and it will give you the path to Rscript.exe. Using that path try this: "...whatever.../Rscript.exe" -e ...your command...
Seemingly Similar Threads
- changing 'https' to 'http' when using download.file(), any side effects or just use RCurl?
- RCurl: using netrc with curlPerform
- Removing Embedded Null characters from text/html
- downloading web content
- Extracting text from html code using the RCurl package.