[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Avoid UnicodeDecodeError when reading the man page
commit 5cd4898a141fcc8550b29333b93a89cbe060506b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Mar 15 14:59:38 2015 -0700
Avoid UnicodeDecodeError when reading the man page
There's probably a better solution but that can wait for the rewrite of this
util function. For now a quick fix for...
Traceback (most recent call last):
File "./run_seth", line 47, in <module>
main()
File "./run_seth", line 16, in main
seth.starter.main()
File "/usr/lib/python2.7/stem/util/conf.py", line 288, in wrapped
return func(*args, config = config, **kwargs)
File "/home/atagar/Desktop/seth/seth/starter.py", line 86, in main
_load_tor_config_descriptions()
File "/home/atagar/Desktop/seth/seth/starter.py", line 239, in _load_tor_config_descriptions
seth.util.tor_config.load_configuration_descriptions(BASE_DIR)
File "/home/atagar/Desktop/seth/seth/util/tor_config.py", line 1088, in load_configuration_descriptions
load_option_descriptions()
File "/home/atagar/Desktop/seth/seth/util/tor_config.py", line 241, in load_option_descriptions
line = ui_tools.get_printable(line)
File "/home/atagar/Desktop/seth/seth/util/ui_tools.py", line 176, in get_printable
line = line.replace('\xc2', "'")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)
---
seth/util/tor_config.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/seth/util/tor_config.py b/seth/util/tor_config.py
index b67445a..5786d69 100644
--- a/seth/util/tor_config.py
+++ b/seth/util/tor_config.py
@@ -2,6 +2,7 @@
Helper functions for working with tor's configuration file.
"""
+import codecs
import os
import time
import socket
@@ -237,6 +238,7 @@ def load_option_descriptions(load_path = None, check_version = True):
last_category, last_description = Category.GENERAL, ""
for line in man_call_results:
+ line = codecs.latin_1_encode(line, 'replace')[0]
line = ui_tools.get_printable(line)
stripped_line = line.strip()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits