I'm trying to suppress a warning in R.
suppressWarnings(httr::GET("localhost:8080/does_not_exist"))
returns an error message
Error in curl::curl_fetch_memory(url, handle = handle) :
Failed to connect to localhost port 8080: Connection refused
I have also tried
suppressMessages(httr::GET("localhost:8080/does_not_exist"))
invisible(capture.output(httr::GET("localhost:8080/does_not_exist")))
but I still get the same error message.
I think you are trying to suppress an error rather than a warning in here. If you really don't want to see an error, you could wrap your function into try() and set the silent argument to TRUE. Something like this:
try("a" + 1, silent = T) #returns nothing
However, generally speaking I would advice not to do something like this, because error messages are useful rather than redundant.
Related
Using R and the package otpr I am trying to run the example
library(otpr)
otpcon <- otp_connect()
otp_get_distance(
otpcon,
fromPlace = c(53.48805,-2.24258),
toPlace = c(53.36484,-2.27108)
)
but i get the error
$errorId
[1] 404
$errorMessage
[1] "No trip found. There may be no transit service within the maximum specified distance or at the specified time, or your start or end point might not be safely accessible."
$query
[1] "http://localhost:8080/otp/routers/default/plan?fromPlace=53.48805,-2.24258&toPlace=53.36484,-2.27108&mode=CAR"
the example I am trying to run is take from here:
https://cran.r-project.org/web/packages/otpr/readme/README.html
Does anyone have an idea about what could be going wrong?
Tried deinsalling an reinstalling all java. Then i get the error
Fejl i otp_connect() :
Router http://localhost:8080/otp/routers/default does not exist. Error code Error in curl::curl_fetch_memory(make_url(x)) :
Failed to connect to localhost port 8080: Connection refused
In order to find some features that I need, I want to establish a connection to a website using open(mycon, "r"). To do this, I used the code below which is provided by #Dunois:
myx <- httr::HEAD(example)$url
mycon <- url(myx)
open(mycon, "r")
where example is a link to a website. This code works perfectly for all websites; however, in some unique cases like "https://www.pixilink.com/140079#mode=tour" or "https://www.pixilink.com/141152#mode=0" it doesn't work. These websites exist and I check them in my browser and I am not sure why the connection cannot be established. The error message I get is:
Error in open.connection(mycon, "r") : cannot open the connection In addition: Warning message: In open.connection(mycon, "r") : cannot open URL 'https://www.pixilink.com/140079#mode=tour': HTTP status was '400 Bad Request'
I appreciate it if you can shed light on this and clarify why I get this error message?
I am new to use a package, gtrendsR, running in R 3.4.1, windows 10.
I succeeded in gconnect, but i get the following error message for any types of query passing to gtrends like below.
library(gtrendsR)
gconnect(usr=my_user_name,psw=my_password)
google.trends = gtrends(c("NHL"), geo="US",start_date="2017-01-01")
Error: Not enough search volume. Please change your search terms.
In addition: Warning message:
In request_GET(x, url, ...) : Gone (HTTP 410).
Anybody has some ideas to solve the problems?
My situation is I wrote an R script using a university windows computer and emailed the file to myself. The first and second time I ran the script it was working perfectly, however, I started having the following error on the third run.
I figured out the line causing the problem and the error message:
> mapdt <-
> geojson_read("http://maperic.clst.org/wupl/Stuff/gz_2010_us_040_00_500k.json",
> what = "sp")
Error in curl::curl_fetch_disk(url, x$path, handle = handle) :
Timeout was reached
I have tried http_proxy method in this link, and it was not working properly. I have the same problem in two different network environment.
Thank you.
I am trying to get some data in json format in using RCurl.
I have to use POST to enter the username and password such as:
postForm(url1, user=x$USERNAME, pass=x$PASSWORD)
I get the following error:
Error in function (type, msg, asError = TRUE) :
SSL read: error:00000000:lib(0):func(0):reason(0), errno 54
If I researched the correct error number 54 from the libcurl site:
CURLE_SSL_ENGINE_SETFAILED (54)
Failed setting the selected SSL crypto engine as default!
If this is the correct error how would I select the SSL engine?
Sorry, but the conclusion about this error is wrong. The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time. I'm not sure what help we can get by knowing it, but 54 in my system equals EXFULL.
You should rather check the return code from the libcurl function that fails to get the proper libcurl error code but I guess you might see CURLE_RECV_ERROR simply because libcurl got tis SSL problem when receiving data.
Unfortunately that error string from openssl is not very helpful and I can't tell why you got it!