mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
python3: Open files in text instead of binary mode
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>
This commit is contained in:
parent
e379dcce57
commit
b98d4244c6
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user