Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdb option doesn't seem to work #79

Closed
markvdw opened this issue May 1, 2020 · 1 comment
Closed

pdb option doesn't seem to work #79

markvdw opened this issue May 1, 2020 · 1 comment

Comments

@markvdw
Copy link

markvdw commented May 1, 2020

I'd like to debug errors that occur when I run a jug script. However, adding the --pdb flag doesn't seem to have any effect.

$ jug execute --debug --pdb jug-init-inducing-fixedhyp.py
...
CRITICAL:root:Could not import file 'jug-init-inducing-fixedhyp.py' (error: too many values to unpack (expected 4))
Traceback (most recent call last):
  File ...

Am I misunderstanding the intended use of the --pdb option?

(Many thanks for the software, it's great)

@luispedro
Copy link
Owner

Glad you like the software.

Indeed, --pdb does not work if the error occurs when the file is first imported, only when the tasks are running. So, currently, this will work as expected:

from jug import TaskGenerator

@TaskGenerator
def raise_error(n):
    if n > 2:
        # <------ error while executing the Tasks: you will be dropped into a debugger
        raise ValueError()

for i in range(10):
    raise_error(i)

I suppose it is a reasonable request to have it work when the error occurs while importing, though.

luispedro added a commit that referenced this issue Jun 11, 2020
Bugfix release

Full ChangeLog:

- Fix handling of `JUG_EXIT_IF_FILE_EXISTS` environmental variable
- Fix passing an argument to jug.main() function
- Extend `--pdb` to exceptions raised while importing the jugfile (issue #79)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants