18π
β
In util.py
edit 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")
And set to:
if not (reportlab.Version[:3] >="2.1"):
raise ImportError("Reportlab Version 2.1+ is needed!")
REPORTLAB22 = (reportlab.Version[:3] >="2.1")
EDIT
While the above works it still uses string literals for version checking. Thereβs a pull request in the xhtml2pdf
project with a more elegant solution that compares versions using tuples of integers. This is the proposed solution:
_reportlab_version = tuple(map(int, reportlab.Version.split('.')))
if _reportlab_version < (2,1):
raise ImportError("Reportlab Version 2.1+ is needed!")
REPORTLAB22 = _reportlab_version >= (2, 2)
π€hanleyhansen
Source:stackexchange.com