summaryrefslogtreecommitdiffstats
path: root/tools/glusterfind/src/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/glusterfind/src/main.py')
-rw-r--r--tools/glusterfind/src/main.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index 72f11a7e02c..a87fac4bdab 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -24,6 +24,7 @@ from utils import setup_logger, human_time, handle_rm_error
from utils import get_changelog_rollover_time, cache_output, create_file
import conf
from changelogdata import OutputMerger
+import codecs
PROG_DESCRIPTION = """
GlusterFS Incremental API
@@ -394,7 +395,7 @@ def enable_volume_options(args):
def write_output(args, outfilemerger):
- with open(args.outfile, "a") as f:
+ with codecs.open(args.outfile, "a", encoding="utf-8") as f:
for row in outfilemerger.get():
# Multiple paths in case of Hardlinks
paths = row[1].split(",")
@@ -409,12 +410,9 @@ def write_output(args, outfilemerger):
if p_rep == row_2_rep:
continue
- p_rep = p_rep.encode('utf8', 'replace')
- row_2_rep = row_2_rep.encode('utf8', 'replace')
-
- f.write("{0} {1} {2}\n".format(row[0],
- p_rep,
- row_2_rep))
+ f.write(u"{0} {1} {2}\n".format(row[0],
+ p_rep,
+ row_2_rep))
def mode_create(session_dir, args):