When outputting text to a file, convert to bytes first.

Fixes #23137
pull/23151/head
Toshio Kuratomi 7 years ago committed by Brian Coca
parent 2e476e64cd
commit 0249918c7b

@ -1,11 +1,12 @@
#!/usr/bin/env python
import os
import io
import sys
from jinja2 import Environment, FileSystemLoader
from ansible.module_utils._text import to_bytes
def get_options(optlist):
''' get actual options '''
@ -124,6 +125,6 @@ if __name__ == '__main__':
manpage = template.render(tvars)
filename = '../man/man1/%s' % output[libname]
with io.open(filename, 'w') as f:
f.write(manpage)
with open(filename, 'wb') as f:
f.write(to_bytes(manpage))
print("Wrote man docs to %s" % filename)

Loading…
Cancel
Save