Importing Packages Pycharm

Asked

Viewed 269 times

7

Guys, I have a problem trying to use a project in pycharm.. I use xhtml2pdf and when trying to debug this error appears :

inserir a descrição da imagem aqui

However I already have the added Packages in the project:

inserir a descrição da imagem aqui

Does anyone have any idea how I can fix this ?

2 answers

7


[RESOLVED]

For those who have the same problem, the latest version of reportlab is 3.x. x however xhtml2pdf/pisa does not accept... for it is required version 2.5 of reportlab however that gives to break in the following way :

Open the File Pisa_util.py

Change the passage :

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

for

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

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

For now this resolves.

3

The package is present but the method in use to verify the version of it is outdated.

As there is already an answer making use of string literals, I will leave an alternative making use of tuples (English) whole:

_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 by the user @hanleyhansen.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.