NCEAS / sasap-training

Training agendas and materials for open science tools for SASAP
https://nceas.github.io/sasap-training
8 stars 6 forks source link

Windows download bug #9

Closed jeanetteclark closed 6 years ago

jeanetteclark commented 6 years ago

Figure out what the windows download bug was and how to fix it

interactions between windows - R - curl?

jeanetteclark commented 6 years ago

I asked Toby what his solution was to this bug, and he says he wrapped the url in the url function before passing to read.csv. Will do some testing today.

jeanetteclark commented 6 years ago

okay - this appears to actually be an issue with windows, when you try to knit a markdown. The above solution did not work but this one does:

library(RCurl)
data <- getURL("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/knb.92379.1",
               ssl.verifypeer=0L, followlocation=1L)
read.csv(text=data)

@cornejotux I think you will still be able to go through the training on windows as-is, but you won't be able to knit

@jkibele can you add RCurl to the list of required packages?

amoeba commented 6 years ago

Hey @jeanetteclark I'm curious if there might be an easier workaround that doesn't involve another package. Does this work for you?

download.file("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/knb.92379.1",
              "out.csv", 
              method = "libcurl")
jeanetteclark commented 6 years ago

Hm, I'll test that but it is a different workflow - saving the file locally and then reading from the file, as opposed to reading from the URL

amoeba commented 6 years ago

How about just

read.csv(url("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/knb.92379.1", 
             method = "libcurl"))

then?

jeanetteclark commented 6 years ago

ah! that works! Thanks @amoeba

nevermind on the RCurl package @jkibele

amoeba commented 6 years ago

If you find any Windows users that can't make this method work, check that their R version is recent. I think this situation might've improved with R 3.4.0.

jeanetteclark commented 6 years ago

hah! @amoeba, after looking through the commit history I just saw that you actually fixed this after the training. you're about 20 steps ahead of the rest of us

https://github.com/NCEAS/sasap-training/commit/114b562d3813a98ec471c895b4d5f4e7f4abc7ae

amoeba commented 6 years ago

And twice as forgetful as anyone! And look at that rockin' commit message. Nice spelunking.