I installed xhtml2pdf
using pip
for use with Django. I am getting the following ImportError:
Reportlab Toolkit Version 2.2 or higher needed
But I have reportlab 3.0
>>> import reportlab
>>> print reportlab.Version
3.0
I found this try catch block in the __init__.py
of xhtml2pdf
:
REQUIRED_INFO = """
****************************************************
IMPORT ERROR!
%s
****************************************************
The following Python packages are required for PISA:
- Reportlab Toolkit >= 2.2 <http://www.reportlab.org/>
- HTML5lib >= 0.11.1 <http://code.google.com/p/html5lib/>
Optional packages:
- pyPDF <http://pybrary.net/pyPdf/>
- PIL <http://www.pythonware.com/products/pil/>
""".lstrip()
log = logging.getLogger(__name__)
try:
from xhtml2pdf.util import REPORTLAB22
if not REPORTLAB22:
raise ImportError, "Reportlab Toolkit Version 2.2 or higher needed"
except ImportError, e:
import sys
sys.stderr.write(REQUIRED_INFO % e)
log.error(REQUIRED_INFO % e)
raise
There's also another error in the util.py
:
if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
Shouldn't that read something like:
if not (reportlab.Version[:3] >="2.1"):
What gives?
reportlab
installed. – Ablepsia