ImportError: Reportlab Version 2.1+ is needed

Share Tweet

Little bug in xhtml2pdf version 0.0.5. To fix:

$ sudo nano /usr/local/lib/python2.7/dist-packages/xhtml2pdf/util.py

Change the following lines:

if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
    raise ImportError("Reportlab Version 2.1+ is needed!")

REPORTLAB22 = (reportlab.Version[0] == "2" and reportlab.Version[2] >= "2")

With these lines:

if not (reportlab.Version[:3] >= "2.1"):
    raise ImportError("Reportlab Version 2.1+ is needed!")

REPORTLAB22 = (reportlab.Version[:3] >= "2.1")
Share Tweet

Questions?

Please start a discussion down below or send me an email!