]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
python3: Open files in text instead of binary mode
authorAndrea Bolognani <abologna@redhat.com>
Thu, 15 Mar 2018 09:56:42 +0000 (10:56 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 15 Mar 2018 16:48:45 +0000 (17:48 +0100)
We use text operations on the contents after reading them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/esx/esx_vi_generator.py
src/hyperv/hyperv_wmi_generator.py

index 2f3c88812d03a64e5171dd101007957e4406a63b..6ce017d794ab5d3865dc0cc707b77c7a0cdc6422 100755 (executable)
@@ -1327,7 +1327,7 @@ def open_and_print(filename):
     else:
         print("  GEN      " + filename)
 
-    return open(filename, "wb")
+    return open(filename, "wt")
 
 
 
@@ -1435,7 +1435,7 @@ block = None
 
 
 # parse input file
-for line in file(input_filename, "rb").readlines():
+for line in open(input_filename, "rt").readlines():
     number += 1
 
     if "#" in line:
index 1cf16a7836c0dfcee80f57e648064f1af33cf0dc..7dc11ba905e0f4446036849a02de67ee200f8ee4 100755 (executable)
@@ -396,7 +396,7 @@ def open_and_print(filename):
     else:
         print("  GEN      " + filename)
 
-    return open(filename, "wb")
+    return open(filename, "wt")
 
 
 
@@ -468,7 +468,7 @@ def main():
     number = 0
     block = None
 
-    for line in file(input_filename, "rb").readlines():
+    for line in open(input_filename, "rt").readlines():
         number += 1
 
         if "#" in line: