mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
python: fix drv_libxml2.py for python3 compatibility
https://bugzilla.gnome.org/show_bug.cgi?id=703979
This commit is contained in:
committed by
Daniel Veillard
parent
33a25af71f
commit
6c9c611bee
@ -34,12 +34,20 @@ TODO
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = u"St<EFBFBD>phane Bidoul <sbi@skynet.be>"
|
__author__ = "St<EFBFBD>phane Bidoul <sbi@skynet.be>"
|
||||||
__version__ = "0.3"
|
__version__ = "0.3"
|
||||||
|
|
||||||
|
import sys
|
||||||
import codecs
|
import codecs
|
||||||
from types import StringType, UnicodeType
|
|
||||||
StringTypes = (StringType,UnicodeType)
|
if sys.version < "3":
|
||||||
|
__author__ = codecs.unicode_escape_decode(__author__)[0]
|
||||||
|
|
||||||
|
from types import StringType, UnicodeType
|
||||||
|
StringTypes = (StringType,UnicodeType)
|
||||||
|
|
||||||
|
else:
|
||||||
|
StringTypes = (str)
|
||||||
|
|
||||||
from xml.sax._exceptions import *
|
from xml.sax._exceptions import *
|
||||||
from xml.sax import xmlreader, saxutils
|
from xml.sax import xmlreader, saxutils
|
||||||
@ -65,7 +73,7 @@ def _d(s):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import libxml2
|
import libxml2
|
||||||
except ImportError, e:
|
except ImportError as e:
|
||||||
raise SAXReaderNotAvailable("libxml2 not available: " \
|
raise SAXReaderNotAvailable("libxml2 not available: " \
|
||||||
"import error was: %s" % e)
|
"import error was: %s" % e)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user