* trap xpath and lxml import error and exit properly

bzr revid: christophe.chauvet@syleam.fr-20080812230228-evi0q3la4hgyfq3v
This commit is contained in:
Christophe Chauvet 2008-08-13 01:02:28 +02:00
parent d7d204b65b
commit 7fff0810f7
2 changed files with 15 additions and 2 deletions

View File

@ -48,7 +48,6 @@
import time
import types
from xml import dom, xpath
import string
import netsvc
import re
@ -58,6 +57,14 @@ import pickle
import fields
import tools
import sys
try:
from xml import dom, xpath
except ImportError:
sys.stderr.write("ERROR: Import xpath module\n")
sys.stderr.write("ERROR: Try to install the old python-xml package\n")
sys.exit(2)
from tools.config import config
regex_order = re.compile('^([a-zA-Z0-9_]+( desc)?( asc)?,?)+$', re.I)

View File

@ -41,7 +41,13 @@ import netsvc
from config import config
import logging
from lxml import etree
import sys
try:
from lxml import etree
except:
sys.stderr.write("ERROR: pythonic binding for the libxml2 and libxslt libraries is missing\n")
sys.stderr.write("ERROR: Try to install python-lxml package\n")
sys.exit(2)
import pickle