diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2000-10-06 17:41:52 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2000-10-06 17:41:52 (GMT) |
commit | 962c9e7f9188c75a3889fcc7fd29fb1626e278d0 (patch) | |
tree | 3656fb89cdb496f4015152b35951276f432df3c7 /Lib/xml/sax/expatreader.py | |
parent | 75698a4937130b0ca8019c553a4be7f02eb5ab0a (diff) | |
download | cpython-962c9e7f9188c75a3889fcc7fd29fb1626e278d0.zip cpython-962c9e7f9188c75a3889fcc7fd29fb1626e278d0.tar.gz cpython-962c9e7f9188c75a3889fcc7fd29fb1626e278d0.tar.bz2 |
Add SAXReaderNotAvailable, and use it to distinguish between an
ImportError, and a missing driver.
Diffstat (limited to 'Lib/xml/sax/expatreader.py')
-rw-r--r-- | Lib/xml/sax/expatreader.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index 2fc2b7c..eb46bcd 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -6,7 +6,10 @@ pyexpat.__version__ == '2.22'. version = "0.20" from xml.sax._exceptions import * -from xml.parsers import expat +try: + from xml.parsers import expat +except ImportError: + raise SAXReaderNotAvailable("expat not supported",None) from xml.sax import xmlreader, saxutils, handler AttributesImpl = xmlreader.AttributesImpl |