Well, I have a problem when trying to use a project in pycharm .. I use xhtml2pdf and when trying to debug this error appears:
ButIalreadyhavethepackagesaddedintheproject:
Does anyone have any idea how I can fix this?
Well, I have a problem when trying to use a project in pycharm .. I use xhtml2pdf and when trying to debug this error appears:
ButIalreadyhavethepackagesaddedintheproject:
Does anyone have any idea how I can fix this?
[RESOLVED]
For those who have the same problem know, the latest version of reportlab is 3.xx but xhtml2pdf / pisa does not accept ... for it is required version 2.5 of reportlab but it breaks down as follows: / p>
Open the Pisa_util.py file
Change the excerpt:
if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
raise ImportError("Reportlab Version 2.1+ is needed!")
by
if not (reportlab.Version[:3]>="2.1"):
raise ImportError("Reportlab Version 2.1+ is needed!")
REPORTLAB22 = (reportlab.Version[:3]>="2.1")
For the time being it will resolve.
Since there is already a response using string literals , I'll leave you an alternative using tuples (English) of integers:
_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)
The solution is referred to in this answer of SOEN by user @hanleyhansen.