Commit 55207ea5 authored by Dylan Baker's avatar Dylan Baker fix python2 compatibility

Because python2 uses bytes, but python3 uses unicode.

CC: Michel Dänzer <>
Fixes: d42d909c
       ("tests: Add script to find all hand written test files")
Tested-by: Brian Paul's avatarBrian Paul <>
parent 9ba94d72
......@@ -28,6 +28,8 @@ import argparse
import io
import os
import six
def main():
parser = argparse.ArgumentParser()
......@@ -55,7 +57,14 @@ def main():
for dirpath, _, filenames in os.walk(directory):
for filename in filenames:
if os.path.splitext(filename)[1] in exts:
files.append(os.path.join(dirpath, filename))
name = os.path.join(dirpath, filename)
if six.PY2:
# This might not be correct, but it's fine. As long as the
# two files are the same it'll work, and utf-8 is what
# everyone *should* be using, and as a superset of ascii
# *should* cover most people
name = name.decode('utf-8', 'replace')
if os.path.exists(args.output):
with, 'rt', encoding='utf-8') as f:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment