mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Make hook run in both python 2 and 3
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
6d09d8fe13
commit
a0a5e0ddac
1 changed files with 7 additions and 2 deletions
|
@ -38,9 +38,14 @@ import subprocess
|
||||||
# Description
|
# Description
|
||||||
# UDAs
|
# UDAs
|
||||||
|
|
||||||
|
try:
|
||||||
|
input_stream = sys.stdin.buffer
|
||||||
|
except AttributeError:
|
||||||
|
input_stream = sys.stdin
|
||||||
|
|
||||||
# Make no changes to the task, simply observe.
|
# Make no changes to the task, simply observe.
|
||||||
old = json.loads(sys.stdin.buffer.readline().decode("utf-8", errors="replace"))
|
old = json.loads(input_stream.readline().decode("utf-8", errors="replace"))
|
||||||
new = json.loads(sys.stdin.buffer.readline().decode("utf-8", errors="replace"))
|
new = json.loads(input_stream.readline().decode("utf-8", errors="replace"))
|
||||||
print(json.dumps(new))
|
print(json.dumps(new))
|
||||||
|
|
||||||
def extract_timew_tags_from(json_obj):
|
def extract_timew_tags_from(json_obj):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue