skgrange / saqgetr

Import Air Quality Monitoring Data in a Fast and Easy Way
GNU General Public License v3.0
9 stars 3 forks source link

closeAllConnections() causes issue when knitting #1

Closed MohoWu closed 5 years ago

MohoWu commented 5 years ago

Hi Stuart,

I'm trying to put up some RMarkdown document using this package. It works fine when run the code interactively in the global environment but when I try to knit it to html the get_saq_observations() throws some error relating to connections.

I think this is due to the use of closeAllConnections() in the read_saq_observations(). See this related SO question: https://stackoverflow.com/a/11165899/4227151

Can we safely delete closeAllConnections()? Otherwise not sure how hard it is to specify which connection to close.

Cheers, Hao

skgrange commented 5 years ago

Hello Hao. It looks like using closeAllConnections is a dirty method so needs replacing. Closing connections is required because it stops errors when many urls (generally a couple of dozen) are generated by the function, but no file exist for the urls. I will have a look this week and let you know when I push a fix.