Make sure 'basestring', 'bytes' and 'unicode' are defined
Python 3 doesn't have 'basestring' and 'unicode'. Python 2.4 doesn't have 'bytes'
This commit is contained in:
parent
f7571cb37f
commit
9f3e5ceb14
1 changed files with 16 additions and 0 deletions
|
@ -73,6 +73,22 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
imap = map # Python 3
|
imap = map # Python 3
|
||||||
|
|
||||||
|
try:
|
||||||
|
basestring
|
||||||
|
except NameError:
|
||||||
|
basestring = str # Python 3
|
||||||
|
|
||||||
|
try:
|
||||||
|
unicode
|
||||||
|
except NameError:
|
||||||
|
unicode = str # Python 3
|
||||||
|
|
||||||
|
try:
|
||||||
|
bytes
|
||||||
|
except NameError:
|
||||||
|
bytes = str # Python 2
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
# Detect the python-json library which is incompatible
|
# Detect the python-json library which is incompatible
|
||||||
|
|
Loading…
Reference in a new issue