Fix unsupported operand type(s) for %: 'bytes' and 'bytes'
This fix also avoid empty file generation on headers lines generation errors.
This commit is contained in:
parent
e241fc0571
commit
57c93181b1
1 changed files with 5 additions and 2 deletions
|
@ -131,9 +131,12 @@ def fix_crc32(path, crc32, lines):
|
||||||
if not options.fix:
|
if not options.fix:
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
|
headers_lines = [
|
||||||
|
b'# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.\n',
|
||||||
|
b'# CRC32 ' + crc32.encode() + b'\n',
|
||||||
|
]
|
||||||
with open(path, 'wb') as fd:
|
with open(path, 'wb') as fd:
|
||||||
lines = [b'# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.\n', b'# CRC32 %s\n' % crc32.encode()] + lines
|
for line in headers_lines + lines:
|
||||||
for line in lines:
|
|
||||||
fd.write(line)
|
fd.write(line)
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
logging.error('%s: fail to write new file content (%s)', path, err)
|
logging.error('%s: fail to write new file content (%s)', path, err)
|
||||||
|
|
Loading…
Reference in a new issue