@KatyaBychko

OSError: cannot load library 'gobject-2.0': error 0x7e Экспорт в PDF?

Я установила пакет weasyprint согласно инструкции (проект Django) https://simpleisbetterthancomplex.com/tutorial/201...
Ошибка выпадает:
OSError at /tyforindividuals/newty
cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'
from django.core.files.storage import FileSystemStorage
from django.http import HttpResponse
from django.template.loader import render_to_string
from weasyprint import HTML


def html_to_pdf_view(request):
    par = ['a', 'b', 'c']
    html_string = render_to_string('my.html', {par})

    html = HTML(string=html_string)
    html.write_pdf(target='/tmp/mypdf.pdf')

    fs = FileSystemStorage('/tmp')
    with fs.open('mypdf.pdf') as pdf:
        response = HttpResponse(pdf, content_type='application/pdf')
        response['Content-Disposition'] = 'attachment; filename="mypdf.pdf"'
        return response
  • Вопрос задан
  • 2424 просмотра
Решения вопроса 1
AlexNest
@AlexNest
Работаю с Python/Django
Первая ссылка в гугле: https://stackoverflow.com/questions/69067530/how-t...
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы