aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-21 16:59:10 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-21 16:59:10 +0100
commitf7300c5c90a99d234a2c7a6d70f5b5baa9d35046 (patch)
tree64220815f5e1399a23b7b0a312a0395adcc64263 /youtube_dl/utils.py
parent3489b7d26c727dac604cf9ece562139372da9bb7 (diff)
[generic] Fix on python 2.6
`ParseError` is not available, it raises `xml.parsers.expat.ExpatError`. The webpage needs to be encoded.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 057cd20d1..471516b8f 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -174,6 +174,11 @@ try:
except NameError:
compat_chr = chr
+try:
+ from xml.etree.ElementTree import ParseError as compat_xml_parse_error
+except ImportError: # Python 2.6
+ from xml.parsers.expat import ExpatError as compat_xml_parse_error
+
def compat_ord(c):
if type(c) is int: return c
else: return ord(c)