GLib-GObject-CRITICAL **: 08:35:12.915: g_object_ref: assertion 'old_val > 0' failed Segmentation fault: 11
I have a python script that leverages WeasyPrint and Jinja2. When I try to run my script that writes multipl HTML files to PDF files, I am getting the below error message:
(process:8363): GLib-GObject-CRITICAL **: 08:35:12.915: g_object_ref: assertion 'old_val > 0' failed
Segmentation fault: 11
- Mac OS X 10.14.3
- python 3.7
- glib 2.60.0
Example
from weasyprint import HTML
html = """
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title of doc</title>
<meta charset="UTF-8">
</head>
<body>
<div style="text-align:center">
<img src="pic.jpg" alt="pic" style="height:500px;width:500px;">
</div>
<div style="text-align:center">
<h1>PDF Title Page</h1>
<h2><i>Subtitle</i></h2>
</div>
<p style="page-break-before: always"></p>
<h1>Page #2</h1>
</body>
</html>
"""
for i in range(5):
HTML(string=html).write_pdf(target=f'/tmp/test-{i}.pdf')
Only test-0.pdf gets written and I get kicked out of my python session.
# Output
(process:8363): GLib-GObject-CRITICAL **: 08:35:12.915: g_object_ref: assertion 'old_val > 0' failed
Segmentation fault: 11