Fix unicode warnings in practracker using python 2
When I run practracker using python 2, I get the following unicode warning:
$ scripts/maint/practracker/practracker.py --regen-overbroad
Traceback (most recent call last):
File "scripts/maint/practracker/practracker.py", line 324, in <module>
main(sys.argv)
File "scripts/maint/practracker/practracker.py", line 268, in main
for item in filt.filter(consider_all_metrics(files_list)):
File "/Users/hyper/dev/tor/scripts/maint/practracker/problem.py", line 147, in filter
for item in iter(sequence):
File "scripts/maint/practracker/practracker.py", line 110, in consider_all_metrics
for item in consider_metrics_for_file(fname, f):
File "scripts/maint/practracker/practracker.py", line 134, in consider_metrics_for_file
for item in consider_function_size(fname, f):
File "scripts/maint/practracker/practracker.py", line 91, in consider_function_size
for name, lines in metrics.get_function_lines(f):
File "/Users/hyper/dev/tor/scripts/maint/practracker/metrics.py", line 58, in get_function_lines
if line.startswith("}"):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: ordinal not in range(128)
Exit 1
We can fix this issue by using the codecs module to open files in unicode mode.