Importing Packages PyCharm

6

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?

    
asked by anonymous 16.10.2014 / 18:24

2 answers

6

[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.

    
20.10.2014 / 14:51
2
The package is present but the method in use to check the version of it is outdated.

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.

    
21.10.2014 / 11:39