Permalink
Browse files

Require chardet instead of charade for python < 2.6

  • Loading branch information...
1 parent 91fa68a commit 46589f27e5cc82407b12db4ea32897a10e46d928 @byroot committed Jan 6, 2013
Showing with 11 additions and 2 deletions.
  1. +5 −1 pysrt/srtfile.py
  2. +6 −1 setup.py
View
@@ -6,7 +6,11 @@
from itertools import chain
from copy import copy
-import charade
+try:
+ import charade
+except ImportError: # For python < 2.6
+ import chardet
+ charade = chardet
from pysrt.srtexc import Error
from pysrt.srtitem import SubRipItem
View
@@ -14,7 +14,12 @@
except:
pass
-REQUIRES = ['charade']
+REQUIRES = []
+if sys.version_info < (2, 6):
+ REQUIRES.append('chardet')
+else:
+ REQUIRES.append('charade')
+
if sys.version_info < (2, 7):
REQUIRES.append('argparse')

2 comments on commit 46589f2

Why not import chardet as charade?

Owner

byroot replied Jan 7, 2013

Because I'm dumb ?

Please sign in to comment.