ubuntu 14.10 python3.4
solarw opened this issue · comments
pre-commit is autodecting python with /usr/bin/env python and returns python2.7
i hardcoded #!/usr/bin/python3 in pre-commit file
run captainhook run shows nothing. no errors. with python2.7 it shows errors about import errors
looks like it does not work with python3.4
@solarw thanks for raising this.
Would you be able to provide an example file that had errors when py2.7 was being used but not py3.4?
(It is being tested against 3.4 on travis, so I'll need to look into this further)
Closing due to inactivity
I've had the same issue today, my project is running in a Vagrant, so I don't have virtualenv. I've installed it under python 3.5 on mac OS, but my default python is Python 2.7.
For the record, the traceback was something like:
> captainhook run
Traceback (most recent call last):
File "/.../.git/hooks/pre-commit", line 37, in <module>
from checkers.utils import get_files, HookConfig, get_config_file
File "/.../.git/hooks/checkers/utils.py", line 12, in <module>
from bash import bash
ImportError: No module named bash
I also needed to hardcode the shebang of .git/hooks/pre-commit
to my python3 version #!/usr/local/bin/python3
. Using #!/usr/bin/env python3
was not picked up by Github desktop.
I'm not expecting a fix for that, my comment is merely for documentation purposes, but an idea would be to replace the shebang in pre-commit at install time? Or does it sound too hacky?