Catch BeautifulSoup ImportError.
This commit is contained in:
Aaron Kavlie 2012-04-12 19:38:59 -07:00
commit 6888a04636

View file

@ -13,7 +13,12 @@ from pelican.utils import slugify
def wp2fields(xml):
"""Opens a wordpress XML file, and yield pelican fields"""
from BeautifulSoup import BeautifulStoneSoup
try:
from BeautifulSoup import BeautifulStoneSoup
except ImportError:
error = 'Missing dependency ' + \
'"BeautifulSoup" required to import Wordpress files.'
sys.exit(error)
xmlfile = open(xml, encoding='utf-8').read()
soup = BeautifulStoneSoup(xmlfile)
@ -40,7 +45,13 @@ def wp2fields(xml):
def dc2fields(file):
"""Opens a Dotclear export file, and yield pelican fields"""
from BeautifulSoup import BeautifulStoneSoup
try:
from BeautifulSoup import BeautifulStoneSoup
except ImportError:
error = 'Missing dependency ' + \
'"BeautifulSoup" required to import Dotclear files.'
sys.exit(error)
in_cat = False
in_post = False