Edinburgh-Genome-Foundry / blabel

:label: Python label/sticker PDF generation. HTML templates, built-in barcodes, qr codes, and other goodies
https://edinburgh-genome-foundry.github.io/blabel
MIT License
179 stars 38 forks source link

Help using Blabel #13

Open coolyear123 opened 3 years ago

coolyear123 commented 3 years ago

I've installed Blabel both with pip and by unzipping the source files but I still get an error in python when I try to do a test run. I don't know whats going on. Attached are the errors.

Traceback (most recent call last): File "C:\Users\DPetit\PycharmProjects\snakeLabels\main.py", line 5, in from blabel import LabelWriter File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\blabel__init.py", line 5, in from .blabel import LabelWriter File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\blabel\blabel.py", line 6, in from weasyprint import HTML File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\weasyprint__init__.py", line 322, in from .css import preprocess_stylesheet # noqa isort:skip File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\weasyprint\css\init__.py", line 27, in from . import computed_values, counters, media_queries File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\weasyprint\css\computed_values.py", line 16, in from ..text.ffi import ffi, pango, units_to_double File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\weasyprint\text\ffi.py", line 380, in gobject = _dlopen( File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\weasyprint\text\ffi.py", line 377, in _dlopen return ffi.dlopen(names[0]) # pragma: no cover File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\cffi\api.py", line 150, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "C:\Users\DPetit\PycharmProjects\AntScan\venv\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib raise OSError(msg) OSError: 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'

Process finished with exit code 1

Zulko commented 3 years ago

Sorry to hear that. It looks like the failure happens during Weasyprint import. You should visit their Github, you may find a solution there (please report back if you do! looks like a Windows/Weasyprint issue).

mightyroy commented 2 years ago
import os
# insert the GTK3 Runtime folder at the beginning
GTK_FOLDER = r'C:\Program Files\GTK3-Runtime Win64\bin'
os.environ['PATH'] = GTK_FOLDER + os.pathsep + os.environ.get('PATH', '')
from blabel import LabelWriter

Add the above before importing other libraries after installing GTK3 on windows. It worked for me.