pydoit / doit

task management & automation tool

Home Page:http://pydoit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with numpy arrays in dodo.py namespace

m2march opened this issue · comments

commented

Having declared a global variable of type numpy.array in the dodo file namespace, I get the following error:

Traceback (most recent call last):
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/doit_cmd.py", line 295, in run
return command.parse_execute(args)
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/cmd_base.py", line 151, in parse_execute
return self.execute(params, args)
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/cmd_base.py", line 591, in execute
self.task_list = self.loader.load_tasks(cmd=self, pos_args=args)
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/cmd_base.py", line 389, in load_tasks
tasks = loader.load_tasks(
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/loader.py", line 142, in load_tasks
funcs = _get_task_creators(namespace, command_names)
File "/home/march/miniconda3/lib/python3.9/site-packages/doit/loader.py", line 240, in _get_task_creators
if ref == task_params:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

This is due to the comparison with the task_params decorator in loader.py:

if ref == task_params:

Possible sanitization is to check that ref is of type function before performing the comparison.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

@m2march Thanks for report. I thought this was a blocker, so made a new release: https://pypi.org/project/doit/0.34.2/