Browse code

kamctl/dbtextdb: solve TypeError: a bytes-like object is required, not 'str'

- GH #2469

(cherry picked from commit 6aa1a84c6e37e0d6d5a725d43636debeaf5fa3b4)
(cherry picked from commit a4fc8afea094b6778b9d264cf9911b69c1a6d22f)
(cherry picked from commit 92f35f285fa8513361afca0d84492438775dc0dc)

Daniel-Constantin Mierla authored on 24/06/2022 06:18:42
Showing 1 changed files
... ...
@@ -1135,7 +1135,7 @@ class DBText(object):
1135 1135
             else:
1136 1136
                 header = '%s)' % header
1137 1137
 
1138
-        self.temp_file.write(header.strip() + '\n')
1138
+        self.temp_file.write((header.strip() + '\n').encode())
1139 1139
 
1140 1140
         # write data
1141 1141
         for row in self.data:
... ...
@@ -1143,7 +1143,7 @@ class DBText(object):
1143 1143
             for col in columns:
1144 1144
                 row_str = '%s:%s' % (row_str, row[col])
1145 1145
 
1146
-            self.temp_file.write(row_str[1:] + '\n')
1146
+            self.temp_file.write((row_str[1:] + '\n').encode())
1147 1147
 
1148 1148
         self.temp_file.flush()
1149 1149