:
ImportError python, ?
ImportError :
- , . , .
- API-, - .
- , , , , , , , .
:
(, lxml ), .
lxml.etree, ElementTree cElementTree API. . ElementTree -Python , cElementTree . lxml.etree , .
:
try:
import super_fast_widget as widget
except ImportError:
try:
import fast_widget as widget
except ImportError:
import slow_widget as widget
, widget , , , - , .
, lxml, . lxml.etree lxml. API .
Django:
try:
from yaml import CSafeLoader as SafeLoader
from yaml import CSafeDumper as SafeDumper
except ImportError:
from yaml import SafeLoader, SafeDumper
Python . , Python, C.
, , , python:
lxml.etree . (getpass) , ( ). ImportError, .
try if platform.system() == 'Windows' , , , try . getpass - API, , .