When I accidentally put a Path()
into updtodate
, I get this stack trace:
Traceback (most recent call last):
File "doit-0.32.0/lib/python3.7/site-packages/doit/doit_cmd.py", line 190, in run
return command.parse_execute(args)
File "doit-0.32.0/lib/python3.7/site-packages/doit/cmd_base.py", line 150, in parse_execute
return self.execute(params, args)
File "doit-0.32.0/lib/python3.7/site-packages/doit/cmd_base.py", line 601, in execute
return self._execute(**exec_params)
File "doit-0.32.0/lib/python3.7/site-packages/doit/cmd_run.py", line 264, in _execute
return runner.run_all(self.control.task_dispatcher())
File "doit-0.32.0/lib/python3.7/site-packages/doit/runner.py", line 256, in run_all
self.run_tasks(task_dispatcher)
File "doit-0.32.0/lib/python3.7/site-packages/doit/runner.py", line 219, in run_tasks
if not self.select_task(node, task_dispatcher.tasks):
File "doit-0.32.0/lib/python3.7/site-packages/doit/runner.py", line 131, in select_task
res = self.dep_manager.get_status(task, tasks_dict)
File "doit-0.32.0/lib/python3.7/site-packages/doit/dependency.py", line 630, in get_status
uptodate_result = utd(*args, **utd_kwargs)
File "doit-0.32.0/lib/python3.7/site-packages/doit/tools.py", line 74, in __call__
self.config_digest = self._calc_digest()
File "doit-0.32.0/lib/python3.7/site-packages/doit/tools.py", line 62, in _calc_digest
data = json.dumps(self.config, sort_keys=True, cls=self.encoder)
File "python3-3.7.6/lib/python3.7/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "python3-3.7.6/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "python3-3.7.6/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "python3-3.7.6/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type PosixPath is not JSON serializable
This is difficult to debug for large doit projects, because it only tells me that "something somewhere is not JSON serializable".
It would be great if doit could tell me which task
, and even better, which key in the object.
I suspect this could be done by catching the JSON encoding error around here:
Line 62 in 6bb833d
and augmenting its error message with the task name.
Environment
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too