Workaround for OrderedDict bug: import from 'ordereddict' backport module if available

This commit is contained in:
Luke Campagnola 2013-10-18 09:46:48 -04:00
parent 54ca31f91b
commit b993c64c48

View File

@ -15,7 +15,12 @@ import threading, sys, copy, collections
try:
from collections import OrderedDict
except:
except ImportError:
# fallback: try to use the ordereddict backport when using python 2.6
try:
from ordereddict import OrderedDict
except ImportError:
# backport not installed: use local OrderedDict
# Deprecated; this class is now present in Python 2.7 as collections.OrderedDict
# Only keeping this around for python2.6 support.
class OrderedDict(dict):