Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Cómo corregir el error de función/símbolo 'pango_context_set_round_glyph_positions'

Implementé un proyecto Django usando Apache2, todo funciona bien, excepto weazyprint, que crea un archivo PDF para los formularios. El pdf funcionaba bien en las pruebas y en el host local.

Ahora, cada vez que accedo al pdf, muestra este error:

 FileNotFoundError at /business_plan/businessplan/admin/info/2/pdf/ [Errno 2] No such file or directory: '/home/ahesham/Portfolio/static\\css\\report.css'

Intenté cambiar el \ y agregarlo dos veces, pero no funcionó aquí es views.py

 def admin_order_pdf(request, info_id): info = get_object_or_404(Info, id=info_id) html = render_to_string('businessplan/pdf.html', {'info': info}) response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'filename="order_{}.pdf"'.format( Info.id) weasyprint.HTML(string=html,base_url=request.build_absolute_uri()).write_pdf(response, stylesheets=[weasyprint.CSS(settings.STATICFILES_DIRS[0] + '\css\\report.css')], presentational_hints=True) return response

El error proviene de este \css\\report.css sabiendo que el archivo report.css está en la carpeta estática y todos los css y js del sitio implementado funcionan perfectamente y probé python manage.py collectstatic no funcionó.

No estoy seguro exactamente de por qué se muestra el error si se debe a las vistas de ubunto o django.

Actualizar:

He intentado cambiar la ubicación para que sea la siguiente:

 stylesheets=[weasyprint.CSS(settings.STATICFILES_DIRS[0] + '/css/report.css')], presentational_hints=True)

Este es el error que apareció

 function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

Así que busqué la solución e intenté descargar este paquete:

 sudo apt-get install libpango1.0-0

y también probé:

 install libpango1.0-dev

pero aún así nada cambió, no funcionaría obteniendo el mismo error.

También intenté reemplazar el directorio estático con la raíz estática a medida que se implementa el proyecto. Obtuve la misma function/symbol 'pango_context_set_round_glyph_positions' lo siguiente:

 stylesheets=[weasyprint.CSS(settings.STATIC_ROOT + '/css/report.css')]

Este es el archivo de configuración:

 STATIC_URL = '/static/' #if DEBUG: # STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] #else: #STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static' )] MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

Estoy usando Ubuntu 18.04 LTS Disk - Servidor Apache2

Mi pregunta: ¿Qué estoy haciendo mal y cómo lo soluciono?

Avíseme si se requiere información adicional para ayudar a corregir este error.

Cualquier comentario será muy apreciado si hay otras formas de mostrar PDF en el administrador de Django

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Probablemente Weasyprint no se descargó correctamente:

tratar:

 pip install django-weasyprint

fuente: https://pypi.org/project/django-weasyprint/

over 4 years ago · Santiago Trujillo Report

0

También me había enfrentado al mismo error.

'pango_context_set_round_glyph_positions' no se encuentra en la biblioteca

creo que debe estar usando la versión 53.0 de weasyprint que requiere la versión 1.44.0+ de pango

degradar la versión de weasyprint a 52.5 resolvió mi problema porque esto no requiere una versión reciente de pango.

también puede consultar esto https://github.com/Kozea/WeasyPrint/issues/1384

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!