From 22bd1e20cbd3c26d2e5dba76e3b0a95ff0a2e154 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Tue, 22 Sep 2020 14:36:55 +0800
Subject: [PATCH 1/6] Fix crit encode TypeError

---
 lib/py/cli.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/py/cli.py b/lib/py/cli.py
index da34302..966dd4e 100755
--- a/lib/py/cli.py
+++ b/lib/py/cli.py
@@ -16,7 +16,10 @@ def inf(opts):
 
 def outf(opts):
     if opts['out']:
-        return open(opts['out'], 'w+')
+        if getattr(opts['func'], '__name__') == 'encode':
+            return open(opts['out'], 'wb+')
+        else:
+            return open(opts['out'], 'w+')
     else:
         return sys.stdout
 
-- 
1.8.3.1

