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

sync: Parse errors in requirements.txt files are not reported correctly #17

Open
suutari-ai opened this issue Oct 12, 2017 · 0 comments
Labels
Projects

Comments

@suutari-ai
Copy link
Collaborator

The sync command should report parse errors of the requirement files rather than just fail with a traceback.

E.g. when doing prequ sync -n *.txt in a directory where there is a non-requirement txt file too, the output will look like this:

$ prequ sync -n *.txt
Traceback (most recent call last):
  File "venv/bin/prequ", line 11, in <module>
    sys.exit(main())
  File "venv/lib/python3.4/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "venv/lib/python3.4/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "venv/lib/python3.4/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "venv/lib/python3.4/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "venv/lib/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "venv/lib/python3.4/site-packages/prequ/scripts/sync.py", line 71, in cli
    to_install, to_uninstall = sync.diff(requirements, installed_dists)
  File "venv/lib/python3.4/site-packages/prequ/sync.py", line 101, in diff
    requirements_lut = {r.link if r.editable else key_from_req(r.req): r for r in compiled_requirements}
  File "venv/lib/python3.4/site-packages/prequ/sync.py", line 101, in <dictcomp>
    requirements_lut = {r.link if r.editable else key_from_req(r.req): r for r in compiled_requirements}
  File "venv/lib/python3.4/site-packages/prequ/utils.py", line 55, in key_from_req
    key = req.name
AttributeError: 'NoneType' object has no attribute 'name'

It should look like this (e.g.):

$ prequ sync -n *.txt
Cannot parse as a requirement file: README.txt
@suutari-ai suutari-ai added the bug label Oct 12, 2017
@suutari-ai suutari-ai added this to To Do in Prequ Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Prequ
  
To Do
Development

No branches or pull requests

1 participant