Skip to content

Errors when calling scrape()  #74

@MAlons97

Description

@MAlons97

I just installed the package and whenever I call scrape() it throws an error.
Copied and pasted from the documentation examples, calling scrape with the default async returns

> dat <- scrape(start = "2013-08-01", end = "2013-08-01")
If file names don't print right away, please be patient.
Error in function (type, msg, asError = TRUE)  : 
> traceback()
7: fun(structure(list(message = msg, call = sys.call()), class = c(typeName, 
       "GenericCurlError", "error", "condition")))
6: function (type, msg, asError = TRUE) 
   {
       if (!is.character(type)) {
           i = match(type, CURLcodeValues)
           typeName = if (is.na(i)) 
               character()
           else names(CURLcodeValues)[i]
       }
       typeName = gsub("^CURLE_", "", typeName)
       fun = (if (asError) 
           stop
       else warning)
       fun(structure(list(message = msg, call = sys.call()), class = c(typeName, 
           "GenericCurlError", "error", "condition")))
   }(3L, "", TRUE)
5: curlPerform(curl = curl, .opts = opts, .encoding = .encoding)
4: getURL(urls, async = async)
3: urlsToDocs(urls, async = async, quiet = quiet)
2: XML2Obs(inning.filez, as.equiv = TRUE, url.map = FALSE, ...)
1: scrape(start = "2013-08-01", end = "2013-08-01")

and when async = TRUE the error returned is

> dat <- scrape(start = "2013-08-01", end = "2013-08-01", async = TRUE)
If file names don't print right away, please be patient.
Error in rapply(docs, function(x) getNodeSet(x, path = xpath), classes = c("XMLInternalDocument",  : 
  'object' must be a list or expression
> traceback()
4: rapply(docs, function(x) getNodeSet(x, path = xpath), classes = c("XMLInternalDocument", 
       "XMLAbstractDocument"), how = "replace")
3: docsToNodes(docs, xpath)
2: XML2Obs(inning.filez, as.equiv = TRUE, url.map = FALSE, ...)
1: scrape(game.ids = twins11[1], async = TRUE)

I've looked at the previous issues and I'm guessing it's related to how the address is read, but nothing in those threads fixed the errors. I've installed (and reinstalled) the package using install.packages("pitchRx"), remotes::install_github("cpsievert/pitchRx"), and devtools::install_github("cpsievert/pitchRx")and restarted my RStudio session each time but it's always the same result.

The same errors occur when using gameIDs instead of start and end dates, ie

> data(gids, package = "pitchRx")
> twins11 <- gids[grepl("min", gids) & grepl("2011", gids)]
> dat <- scrape(game.ids = twins11[1])
If file names don't print right away, please be patient.
Error in function (type, msg, asError = TRUE)  : 
> dat <- scrape(game.ids = twins11[1], async = TRUE)
If file names don't print right away, please be patient.
Error in rapply(docs, function(x) getNodeSet(x, path = xpath), classes = c("XMLInternalDocument",  : 
  'object' must be a list or expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions