diff options
author | Adrian Page <adrian@pagenet.plus.com> | 2017-10-28 18:34:35 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-10-28 19:34:35 +0200 |
commit | be8abbdf9cbab6ea82a1b16ad144a55783c5f45b (patch) | |
tree | 899ae3c23688bb7f9b48a70da8795ec4346a666c | |
parent | 516269a43646693a3ef4423ba0c2890a816e89bc (diff) | |
download | psutil-be8abbdf9cbab6ea82a1b16ad144a55783c5f45b.tar.gz |
Fix pre-commit hook for python 3.x. (#1159)
sh() return value is a string due to Popen(universal_newlines=True).
Traceback (most recent call last):
File ".git/hooks/pre-commit", line 118, in <module>
main()
File ".git/hooks/pre-commit", line 78, in main
py_files = [x for x in out.split(b'\n') if x.endswith(b'.py') and
TypeError: must be str or None, not bytes
-rwxr-xr-x | .git-pre-commit | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/.git-pre-commit b/.git-pre-commit index a2f2d18e..c3c605e0 100755 --- a/.git-pre-commit +++ b/.git-pre-commit @@ -75,7 +75,7 @@ def sh(cmd): def main(): out = sh("git diff --cached --name-only") - py_files = [x for x in out.split(b'\n') if x.endswith(b'.py') and + py_files = [x for x in out.split('\n') if x.endswith('.py') and os.path.exists(x)] lineno = 0 |