Skip to content
Snippets Groups Projects
Commit 3987b201 authored by Václav Bartoš's avatar Václav Bartoš
Browse files

warden_filer: compatibility with Python3

parent 79fd808f
No related branches found
No related tags found
No related merge requests found
...@@ -187,7 +187,7 @@ def receiver(config, wclient, sdir, oneshot): ...@@ -187,7 +187,7 @@ def receiver(config, wclient, sdir, oneshot):
nf = sdir.newfile() nf = sdir.newfile()
with nf.f as f: with nf.f as f:
data = json.dumps(event) data = json.dumps(event)
f.write(data) f.write(data.encode('utf-8'))
nf.moveto(sdir.incoming) nf.moveto(sdir.incoming)
count_ok += 1 count_ok += 1
except Exception as e: except Exception as e:
...@@ -297,7 +297,7 @@ def sender(config, wclient, sdir, oneshot): ...@@ -297,7 +297,7 @@ def sender(config, wclient, sdir, oneshot):
continue # Silently go to next filename, somebody else might have interfered continue # Silently go to next filename, somebody else might have interfered
try: try:
with nf.open("rb") as fd: with nf.open("rb") as fd:
data = fd.read() data = fd.read().decode('utf-8')
event = json.loads(data) event = json.loads(data)
if not match_event(event, **filt): if not match_event(event, **filt):
wclient.logger.debug("Unmatched event: %s" % data) wclient.logger.debug("Unmatched event: %s" % data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment