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

Dazel + Python2 #28

Closed
TimZaman opened this issue Jan 4, 2018 · 4 comments
Closed

Dazel + Python2 #28

TimZaman opened this issue Jan 4, 2018 · 4 comments

Comments

@TimZaman
Copy link

TimZaman commented Jan 4, 2018

Hello! Thanks for a neat tool. Currently giving it a spin on OS-X with Python2.7.
So dazel.py seems to depend on Python 3 per #!/usr/bin/env python3 and usage of some Python3 functionality i.e.shutil.get_terminal_size(). Is dazel supposed to work with python 2 at all? If no, should it be py2 compatible on Pypi?

@mishas
Copy link
Collaborator

mishas commented May 22, 2018

Hello Tim,

First of all, let me say that dazel is a binary, so you shouldn't care if it's python3 or python2. If you want to use it - just install python3 alongside with python2 on your mac, and use dazel.

With that said, you're right about the shutil: We should either not use it, or define dazel as non-python2 compatible. I'm leaving this ticket open so that we'll do that at some point.

BTW - The shebang line is actually irrelevant. Due to how it's defined in the setup.py file, there's actually another entrypoint created (with a different shebang line), that imports this file. So - as long as we didn't use shutil, it would've worked with python2 even with that "bad" shebang line.

@llarco
Copy link

llarco commented Jun 21, 2019

Hi,

I'm running into this issue with shutil.get_terminal_size():

$ dazel build //...:all
Traceback (most recent call last):
  File "/usr/local/bin/dazel", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/dazel.py", line 541, in main
    return di.send_command(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/dazel.py", line 140, in send_command
    term_size = shutil.get_terminal_size()
AttributeError: 'module' object has no attribute 'get_terminal_size'

I do have both versions of python installed. Is there any specific configuration I should use? Otherwise, is there a workaround to the shutil.get_terminal_size() line?

@mishas
Copy link
Collaborator

mishas commented Jun 21, 2019

Uninstall dazel (pip uninstall dazel) and install it again with pip3 (pip3 install dazel).
Should work then. You might need to start a new shell window for that.

@llarco
Copy link

llarco commented Jun 21, 2019

Uninstall dazel (pip uninstall dazel) and install it again with pip3 (pip3 install dazel).
Should work then. You might need to start a new shell window for that.

That worked, thanks!

@mishas mishas closed this as completed Jun 21, 2019
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