assert verify is not None
filename = "{}out".format(zone)
- with open(filename, 'w') as file:
+ with open(filename, 'w', encoding='utf-8') as file:
for rr in transfer.answer:
file.write(rr.to_text())
file.write('\n')
print("read state file {}".format(filename))
try:
- with open(filename, 'r') as file:
+ with open(filename, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith(';'):
continue
print("read log file {}".format(filename))
try:
- with open(filename, 'r') as file:
+ with open(filename, 'r', encoding='utf-8') as file:
s = mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ)
if s.find(bytes(log, "ascii")) != -1:
found = True
print("No python yaml module, skipping")
sys.exit(1)
-with open(sys.argv[1], "r") as f:
+with open(sys.argv[1], "r", encoding="utf-8") as f:
for item in yaml.safe_load_all(f):
for key in sys.argv[2:]:
try:
def run(self):
# pylint: disable=consider-using-with
- with open(os.devnull, 'w') as devnull:
+ with open(os.devnull, 'w', encoding='utf-8') as devnull:
self.sub_process = subprocess.Popen(self.get_command(), shell=True,
stdout=devnull)
assert os.path.isfile(rpz_passthru_logfile)
assert os.path.isfile(rpz_logfile)
- with open(rpz_passthru_logfile) as log_file:
+ with open(rpz_passthru_logfile, encoding='utf-8') as log_file:
line = log_file.read()
assert "rpz QNAME PASSTHRU rewrite allowed/A/IN" in line
- with open(rpz_logfile) as log_file:
+ with open(rpz_logfile, encoding='utf-8') as log_file:
line = log_file.read()
assert "rpz QNAME PASSTHRU rewrite allowed/A/IN" not in line
assert "rpz QNAME NXDOMAIN rewrite baddomain/A/IN" in line