small medium large xlarge

06 Mar 2018, 23:05
Naz Salhab (1 post)

Thanks Brian for writing a great book. I’ve been following along by testing my own application but I’d also like to try out the Tasks project. I downloaded and installed it, and when I just type tasks it seems to be OK:

ubuntu@ubuntu-VirtualBox:~/book/code/tasks_proj$ tasks
Usage: tasks [OPTIONS] COMMAND [ARGS]...

  Run the tasks application.

  --version   Show the version and exit.
  -h, --help  Show this message and exit.

  add     add a task
  count   list count
  delete  delete a task
  list    list tasks
  update  update task

But when I try tasks list something goes awry:

ubuntu@ubuntu-VirtualBox:~/book/code/tasks_proj$ tasks list
  ID      owner  done summary
  --      -----  ---- -------
Traceback (most recent call last):
  File "/usr/local/bin/tasks", line 11, in <module>
    load_entry_point('tasks==0.1.0', 'console_scripts', 'tasks')()
  File "/usr/local/lib/python3.5/dist-packages/click-6.7-py3.5.egg/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click-6.7-py3.5.egg/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/click-6.7-py3.5.egg/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/click-6.7-py3.5.egg/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/click-6.7-py3.5.egg/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tasks-0.1.0-py3.5.egg/tasks/", line 47, in list_tasks
  File "/usr/lib/python3.5/", line 59, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.5/dist-packages/tasks-0.1.0-py3.5.egg/tasks/", line 81, in _tasks_db
  File "/usr/local/lib/python3.5/dist-packages/tasks-0.1.0-py3.5.egg/tasks/", line 118, in start_tasks_db
  File "/usr/local/lib/python3.5/dist-packages/tasks-0.1.0-py3.5.egg/tasks/", line 68, in start_tasks_db
  File "/usr/local/lib/python3.5/dist-packages/tasks-0.1.0-py3.5.egg/tasks/", line 18, in __init__
  File "/usr/local/lib/python3.5/dist-packages/tinydb-3.8.0-py3.5.egg/tinydb/", line 145, in __init__
    self._storage = storage(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tinydb-3.8.0-py3.5.egg/tinydb/", line 89, in __init__
    touch(path, create_dirs=create_dirs)  # Create file if not exists
  File "/usr/local/lib/python3.5/dist-packages/tinydb-3.8.0-py3.5.egg/tinydb/", line 24, in touch
    with open(fname, 'a'):
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/tasks_db//tasks_db.json'

I get a similar response when I try anything else, e.g. tasks add "buy milk" I’m using Python 3.5.2 in Ubuntu 16.04 (which isn’t my natural habitat)

12 Mar 2018, 13:50
Brian Okken (8 posts)

The problem is that “/home/ubuntu/tasks_db/” doesn’t exist. It looks like I didn’t test for the case of “~/tasks_db” not existing. Create it, and the application should work.

mkdir /home/ubuntu/tasks_db/ should do the trick.

You must be logged in to comment