Project

General

Profile

Bug #10550

Specify version when importing Poppler with gi

Added by intrigeri almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
11/15/2015
Due date:
% Done:

0%

QA Check:
Ready for QA
Feature Branch:
Starter:

Description

With recenty pygi I see lots of:

PyGIWarning: Poppler was imported without specifying a version first. Use gi.require_version('Poppler', '0.18') before import to ensure that the right version gets loaded

History

#1 Updated by jvoisin almost 4 years ago

  • Status changed from Confirmed to Fix committed

#2 Updated by intrigeri almost 4 years ago

  • Status changed from Fix committed to In Progress
  • Assignee set to jvoisin
  • QA Check set to Ready for QA

Thanks for fixing it in libmat/office.py. What about doing the same everywhere else, e.g.:

diff --git a/libmat/strippers.py b/libmat/strippers.py
index c170332..53591ad 100644
--- a/libmat/strippers.py
+++ b/libmat/strippers.py
@@ -25,6 +25,8 @@ logging.basicConfig(level=mat.LOGGING_LEVEL)
 # PDF support
pdfSupport = True
try:
+    import gi
+    gi.require_version('Poppler', '0.18')
from gi.repository import Poppler
except ImportError:
logging.error('Unable to import Poppler: no PDF support')
diff --git a/test/test.py b/test/test.py
index 34bb4b2..3f259a7 100644
--- a/test/test.py
+++ b/test/test.py
@@ -29,6 +29,7 @@ FILE_LIST = zip(clean, dirty)
try:  # PDF render processing
import cairo
import gi
+    gi.require_version('Poppler', '0.18')
from gi.repository import Poppler
import pdfrw
except ImportError:

Similarly, this would make mat-gui less noisy:

--- a/mat-gui
+++ b/mat-gui
@@ -3,6 +3,8 @@

""" Metadata anonymisation toolkit - GUI edition """ 

+import gi
+gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gtk, GLib
from gi.repository import Gdk, GdkPixbuf

Thanks for considering :)

#3 Updated by jvoisin almost 4 years ago

  • Status changed from In Progress to Fix committed

#4 Updated by jvoisin almost 4 years ago

  • Status changed from Fix committed to Resolved

Also available in: Atom PDF