pydoit / doit

CLI task management & automation tool
http://pydoit.org
MIT License
1.87k stars 175 forks source link

FileNotFoundError: [Errno 2] No such file or directory: '.doit.db.dat' #395

Closed Vaunorage closed 3 years ago

Vaunorage commented 3 years ago

Environment

  1. OS: windows 10
  2. python version: 3.8.5
  3. doit version: 0.33.1

After I run my code I always get this error saying that it cannot find the '.doit.db.dat' file

dodo.py

"""
File with command for automated testing tasks
"""
import os
import pathlib

current_path = pathlib.Path.cwd()

def task_remove_doit_files():
    for zippath in current_path.rglob('.doit.*'):
        zippath.unlink()

def task_format():
    return {
        'actions': [
            "pipenv run brunette {} --config=setup.cfg".format(current_path.joinpath("app").as_posix()),
            "pipenv run brunette {} --config=setup.cfg".format(current_path.joinpath("tests").as_posix()),
            "pipenv run isort {} ".format(current_path.joinpath("app").as_posix()),
            "pipenv run isort {} ".format(current_path.joinpath("tests").as_posix())
        ],
        'verbosity': 2,
        'clean': True,
    }

def task_test():
    def run_mypy():
        os.system("pipenv run mypy")
        return True

    return {
        'actions': [
            run_mypy,
            "pipenv run pytest --cov --cov-fail-under=90",
        ],
        'verbosity': 2
    }

def task_check():
    return {
        'actions': [
            "pipenv lock",
            # "pipenv run doit format"
        ],
        'verbosity': 2
    }

def task_run_local():
    return {
        'actions': [
            "python manage.py makemigrations",
            "python manage.py migrate",
            "waitress-serve --listen=127.0.0.1:8000 app.wsgi:application"
        ],
        'verbosity': 2
    }

Command

doit format

Traceback (most recent call last):
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\doit_cmd.py", line 190, in run
    return command.parse_execute(args)
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\cmd_base.py", line 150, in parse_execute
    return self.execute(params, args)
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\cmd_base.py", line 601, in execute
    return self._execute(**exec_params)
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\cmd_run.py", line 264, in _execute
    return runner.run_all(self.control.task_dispatcher())
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\runner.py", line 261, in run_all
    self.finish()
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\runner.py", line 240, in finish
    self.dep_manager.close()
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\dependency.py", line 514, in close
    self.backend.dump()
  File "c:\users\vaun_\pycharmprojects\untitled1\.venv\lib\site-packages\doit\dependency.py", line 179, in dump
    self._dbm[task_id] = self.codec.encode(self._db[task_id])
  File "d:\minconda3\lib\dbm\dumb.py", line 200, in __setitem__
    self._addkey(key, self._addval(val))
  File "d:\minconda3\lib\dbm\dumb.py", line 158, in _addval
    with _io.open(self._datfile, 'rb+') as f:
FileNotFoundError: [Errno 2] No such file or directory: '.doit.db.dat'
schettino72 commented 3 years ago

That task_remove_doit_files looks suspicious... I would guess you have messed up with leftover (corrupted files). make sure you remove all '.doit.db.*' files and see what happens.