ropensci / taxizedb

Tools for Working with Taxonomic SQL Databases
Other
30 stars 7 forks source link

downloading error in `db_download_*` functions (due to missing directory .taxize_local) #6

Closed dlebauer closed 7 years ago

dlebauer commented 8 years ago

When I try to follow the README, none of the db_download_* functions work

> x <- db_download_tpl()
downloading...
Error in curl::curl_download(db_url, db_path, quiet = TRUE) : 
  Failed to open file /Users/dlebauer/.taxize_local/plantlist.zip.

This worked after I created the directory $HOME/.taxize_local.

dir.create("~/.taxize_local")

I'd submit a pull request, but would suspect that this could either be created on loading the library or on first running any of the download functions.

dlebauer commented 8 years ago

After downloading the database, I get the following

> db_load_tpl(x)
creating PostgreSQL database...
Error in postgresqlNewConnection(drv, ...) : 
  RS-DBI driver: (could not connect sacmac@local on dbname "sacmac"
)
sckott commented 8 years ago

thanks for the reports, right, ran into that curl problem elsewhere recently, I think write_disk used to create the dir if not present, but we will just do it manually. looks like db_load_tpl has my machine's name by default, will look into that

sckott commented 8 years ago

@dlebauer can you try agagin after reinstalling devtools::install_github("ropenscilabs/taxizedb")

dlebauer commented 8 years ago

That fixes the issue with the .taxize_local directory, but I still get an error with the db_load_tpl function, and I tried:

db_load_tpl(x, user = 'dlebauer')
db_load_tpl(x, user = 'testuser', pwd = 'testpwd')

db_load_tpl(x, user = 'dlebauer', verbose = TRUE) creating PostgreSQL database... Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (could not connect dlebauer@local on dbname "dlebauer" )

db_load_tpl(x) creating PostgreSQL database... Error in postgresqlNewConnection(drv, ...) : user argument cannot be NULL

Where either of the following works:

psql -U dlebauer 
psql -U testuser -p

... looks to like it may be re-using the username as the dbname ... wouldn't it make sense for the dbname to be given a sensible default (e.g. tpl in this case)?

sckott commented 8 years ago

that's weird, the dbname is hardcoded to be plantlist, the code is https://github.com/ropenscilabs/taxizedb/blob/master/R/downloads.R#L123

maybe there is just a database connection problem?

you could manually try this on the command line https://github.com/ropenscilabs/taxizedb/blob/master/R/downloads.R#L124 that's the code to load the database into postgres - for me that's psql -U sacmac plantlist < /Users/sacmac/.taxize_local/plantlist.sql