Closed hmgaudecker closed 2 years ago
Are you able to replicate it?
pytask tries to infer the file and line number of the task function which is here the function to compile a latex document that has partialed arguments. You cannot directly get the source of a partialed function, instead, you need to check the underlying function. This should be checked here:
So, I am curious why this check fails. Maybe in [17] > /home/hmg/miniconda3/envs/ambig_beliefs/lib/python3.9/site-packages/_pytask/console.py(220)_get_source_lines() -> return inspect.getsourcelines(function)[1]
you can test isinstance(function, functools.partial)
.
Ah, maybe it is something introduced during my LaTeX changes after all?
> /home/hmg/miniconda3/envs/ambig_beliefs/lib/python3.9/site-packages/_pytask/console.py(220)
215 def _get_source_lines(function: Callable[..., Any]) -> int:
216 """Get the source line number of the function."""
217 if isinstance(function, functools.partial):
218 return _get_source_lines(function.func)
219 else:
220 -> return inspect.getsourcelines(function)[1]
(Pdb++) function
<function wrap_function_for_post_mortem_debugging.<locals>.wrapper at 0x7f65f04d0d30>
Running things with debug flag yields an error:
Digging a bit deeper:
No big deal in the end, the issue is more that
pytask
quit without informing the user of anything. I ended up there somewhat by chance and ended up worrying whether recent changes to environment or tex-files had caused this; in the end I think it's about the first time I ran that project with the--pdb
flag turned on.