Scifabric / pbs

PYBOSSA command line client
GNU Affero General Public License v3.0
10 stars 11 forks source link

pbs add_tasks fails with TypeError #35

Open christopherthomson opened 7 years ago

christopherthomson commented 7 years ago

Thanks for creating the pbs command line tool. I'm trying to follow the Pybossa tutorial but get a type error at the add_tasks step. It looks like one of the variables in the _pybossa_req function is returning None. I get the same result using the sample JSON file from the Pybossa tutorial, and the same result again after creating this file by running the get_images.py script.

Here is the traceback:

(pybossa-env)vagrant@vagrant-ubuntu-trusty-64:/vagrant/app-flickrperson$ pbs add_tasks --tasks-file flickr_tasks.csv --tasks-type=csv Traceback (most recent call last): File "/home/vagrant/pybossa-env/bin/pbs", line 11, in sys.exit(cli()) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 488, in call return self.main(args, kwargs) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 474, in main self.invoke(ctx) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 775, in invoke return self.invoke_subcommand(ctx, cmd, cmd_name, ctx.args[1:]) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 784, in invoke_subcommand return cmd.invoke(cmd_ctx) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 676, in invoke ctx.invoke(self.callback, ctx.params) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke return callback(args, kwargs) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func return ctx.invoke(f, obj, *args[1:], *kwargs) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke return callback(args, kwargs) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/pbs.py", line 164, in add_tasks res = _add_tasks(config, tasks_file, tasks_type, priority, redundancy) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/helpers.py", line 198, in _add_tasks config.all) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/helpers.py", line 301, in find_project_by_short_name response = pbclient.find_project(short_name=short_name, all=all) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/pbclient/init.py", line 196, in find_project res = _pybossa_req('get', 'project', params=kwargs) File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/pbclient/init.py", line 37, in _pybossa_req url = _opts['endpoint'] + '/api/' + domain TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Thanks.

teleyinex commented 7 years ago

Hi,

Thanks for reporting this issue. We just released a new version yesterday, would you mind to tell us which version do you have in your system?

christopherthomson commented 7 years ago

I should have included this first up. pbs version is 2.4.0:

(pybossa-env)vagrant@vagrant-ubuntu-trusty-64:/vagrant$ cd app-flickrperson/ (pybossa-env)vagrant@vagrant-ubuntu-trusty-64:/vagrant/app-flickrperson$ pbs version 2.4.0

I set up the VM using instructions here.

teleyinex commented 7 years ago

Ha, I've just tested a new install with my own data set and it works. Would you mind to share some data so we can test it?

christopherthomson commented 7 years ago

Hi, I'm using the flickr_tasks.csv file that comes with the tutorial app. I think they're images from your flickr account! I also tried the get_images.py script which creates a json file but this also gives the same error. Do the strings in the CSV need to be wrapped in quotes perhaps?

christopherthomson commented 7 years ago

Further info: I'm using Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-119-generic x86_64) running in a VM using Vagrant 1.9.2 and VirtualBox Version 5.1.22 r115126 (Qt5.5.1). The host machine is Ubuntu 16.04.

I just upgraded pbs (pip install --upgrade pybossa-pbs) to version 2.4.2, but get the same error upon running the add_tasks command:

File "/home/vagrant/pybossa-env/local/lib/python2.7/site-packages/pbclient/init.py", line 38, in _pybossa_req url = _opts['endpoint'] + '/api/' + domain TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

christopherthomson commented 7 years ago

I have it working now. I created the config file at ~/.pybossa.cfg and now things work. I got the impression this step was optional but may have misread. Thanks for your help!

teleyinex commented 7 years ago

Then it looks like you have found a bug. We all use the pybossa.cfg file, so maybe that's why we are not seeing that bug. I'll try to replicate it.