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

AttributeError: module 'click' has no attribute 'FloatRangeecho' #636

Closed
chaoflow opened this issue Feb 10, 2018 · 3 comments
Closed

AttributeError: module 'click' has no attribute 'FloatRangeecho' #636

chaoflow opened this issue Feb 10, 2018 · 3 comments

Comments

@chaoflow
Copy link
Contributor

Describe the issue briefly here.

Environment Versions
  1. Linux
  2. Python version: 3.6.4
  3. pip version: 9.0.1
  4. pip-tools version: 1.11.0
Steps to replicate
  1. python3.6 -m venv venv
  2. ./venv/bin/pip install -e git+https://github.com/pallets/click@55682f6f5348f5220a557f89c3a796321a52aebf#egg=click
  3. ./venv/bin/pip install pip-tools==1.11.0
  4. ./venv/bin/pip-compile --help
Expected result

Display help message.

Actual result
% ./venv/bin/pip-compile --help                                                             
Traceback (most recent call last):
  File "./venv/bin/pip-compile", line 7, in <module>
    from piptools.scripts.compile import cli
  File "/path/to/venv/lib/python3.6/site-packages/piptools/scripts/compile.py", line 13, in <module>
    from .. import click
  File "path/to/venv/lib/python3.6/site-packages/piptools/click.py", line 6, in <module>
    from click import *  # noqa
AttributeError: module 'click' has no attribute 'FloatRangeecho'
% grep -i FloatRangeecho /path/to/venv/src/click/click -R                
Binary file /path/to/venv/src/click/click/__pycache__/__init__.cpython-36.pyc matches
% grep -i FloatRangeecho /path/to/venv/lib/python3.6/site-packages/piptools -R
%
@vphilippon
Copy link
Member

Hi @chaoflow, thanks for the report.

I was able to reproduce the issue by doing simply this:

  1. python3.6 -m venv venv
  2. ./venv/bin/pip install -e git+https://github.com/pallets/click@55682f6f5348f5220a557f89c3a796321a52aebf#egg=click
  3.  $ python
     >>> from click import *
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     AttributeError: 'module' object has no attribute 'FloatRangeecho'
    

I'm not sure what's going on. FloatRangeecho isn't even a type defined in click. Something seems odd. Doing from X import * is generally discouraged, but is still valid.

This can either be raised over to the click devs, or assumed to be a quirk of this dev, unreleased version of click.

pip-tools could be adjusted to only import the necessary click modules to avoid this specific issue.

@suutari
Copy link
Contributor

suutari commented Feb 21, 2018

The culprit is a missing comma at the end of this line: https://github.com/pallets/click/blob/55682f6f5348f5220a557f89c3a796321a52aebf/click/__init__.py#L69

The line ends with string literal 'FloatRange' which is then concatenated with the next string literal 'echo' on line 72, because there is no comma in between.

@suutari suutari closed this as completed Feb 21, 2018
suutari added a commit to suutari/click that referenced this issue Feb 21, 2018
The 'FloatRange' string was incorrectly concatened with the 'echo' on
line below producing 'FloatRangeecho', because there was no comma in
between.  This caused import errors when doing

    from click import *

See e.g. jazzband/pip-tools#636
@chaoflow
Copy link
Contributor Author

thx a lot!

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

3 participants