weecology / retriever

Quickly download, clean up, and install public datasets into a database management system
http://data-retriever.org
Other
306 stars 134 forks source link

Catch errors when `install` and `download` are run w/o arguments #774

Closed ethanwhite closed 7 years ago

ethanwhite commented 7 years ago

Running install and download without the name of a dataset triggers a messy Python error. We should report the associated usage help instead.

ethan@gandalf:~$ retriever install
Traceback (most recent call last):
  File "/home/ethan/miniconda3/bin/retriever", line 11, in <module>
    load_entry_point('retriever==2.0.dev0', 'console_scripts', 'retriever')()
  File "/home/ethan/miniconda3/lib/python3.5/site-packages/retriever/__main__.py", line 159, in main
    engine = choose_engine(args.__dict__)
  File "/home/ethan/miniconda3/lib/python3.5/site-packages/retriever/lib/tools.py", line 124, in choose_engine
    enginename = enginename.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
henrykironde commented 7 years ago

@ethanwhite could you try to run that command retriever install if error, followed by retriever update

Parth-25m commented 7 years ago

I think that the issue has been resolved.

henrykironde commented 7 years ago

@Parth-25m did you try to run retriever install? And what os are you using?

Parth-25m commented 7 years ago

yes

`retriever git:(master) retriever install

usage: retriever install [-h] [--compile] [--debug] {mysql,postgres,sqlite,msaccess,csv,json,xml} ...

retriever install: error: too few arguments

➜ retriever git:(master) ✗ retriever download

Exception: no dataset specified. `

ethanwhite commented 7 years ago

Looks like this might be a Python version number difference. On Ubuntu using Python 2 I get the correct behavior, but using Python 3 I get the error reported above. Can anyone else confirm that this is the source of the different behaviors?

zhangcandrew commented 7 years ago

I am on Ubuntu, running Python 3 with the most current version of retriever. I am also getting the error above, mentioned by Ethan.

henrykironde commented 7 years ago

This could be a permission issue, could you give me the sequence of command you are running including the command you are using to install

ethanwhite commented 7 years ago
pip install . --upgrade
retriever install

@henrykironde - are you not seeing this on Python 3?

henrykironde commented 7 years ago

my errors vary, I am going through it to find out why there is a difference