when i import pdf i get this error Gtk-Message: Failed to load module "gnomebreakpad" Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/bin/pdfshuffler", line 964, in run thumbnail = self.load_pdf_thumbnail(pdfdoc, npage, angle, crop) File "/usr/bin/pdfshuffler", line 1010, in load_pdf_thumbnail pixbuf.fill(0xffffffff) NameError: global name 'pixbuf' is not defined Reproducible: Always
Given the *stunning* amount of info provided, it's rather hard to say anything conclusive, but the first guess would go to bug 377063.
Created attachment 292641 [details] emerge --info
Version of poppler on my gentoo box app-text/poppler-0.16.7 dev-python/python-poppler-0.12.1-r1
...well, the other possibility is that the pdf in question has been created with a broken version of simple-scan (it's been producing broken pdfs until quite recently). Of course, the fact, that the line pixbuf.fill(0xffffffff) should have been thumbnail.fill(0xffffffff) is an independent matter.
At a wild guess, it looks like it cannot initialise a pixel buffer, so that might cause output to default to something blank when the import error is ignored. Maybe a matter of running python-updater?
I ran python-updater, but it doesn't work. I tried a lot of pdf, but the result doesn't change...
Honestly, see https://bugzilla.redhat.com/show_bug.cgi?id=705153, then read bug 377063 for the reason why the solution proposed there is not applicable. Also, while I copy-pasted the code from poppler to python-poppler, I still think, that the real solution would be implementing the code in pdfshuffler - python-poppler was meant to be a wrapper, not provide its own API.
Created attachment 292959 [details, diff] a few pdfshuffler fixes - pygtk version Just for the kicks - this patch for pdfshuffler makes it stop using render_to_pixbuf method. It touches a few other things too - i.e. it ensures tracebacks are still printed in that part of code, as the total suppression made it a pain to modify.
Created attachment 292961 [details, diff] introspection port attempt ...and on top of the previous patch, this one moves pdfshuffler from pygtk/python-poppler to introspection for both. It's very much a work in progress, but it seems to be *mostly* working - though as I'm not exactly a pdfshuffler user, I can't really say if I didn't miss a part or two (most likely I did). It seems a bit slower on load, as I needed to move it from threading to idle and so interface is updated only after the file is completely loaded - I think this part can be done better.
Just to note, the solution appears to be the removal of one of the patches to python-poppler which overrides the behavior of pixbuf. I will test this and see. For reference, here is the redhat/fedora bug that discusses the solution. https://bugzilla.redhat.com/show_bug.cgi?id=705153 I have also confirmed this bug and assigned it to the python team. Thanks!
I can now confirm that the removal of the "${FILESDIR}"/${P}-76_75.diff patch from dev-python/python-poppler fixes pdfshuffler. However, I do not know if it breaks anything else that depends on python-poppler
(In reply to comment #10) > > https://bugzilla.redhat.com/show_bug.cgi?id=705153 > I already said in comment 7, that due to changes in poppler 0.18, solution from that bug is incorrect.
(In reply to comment #12) > (In reply to comment #10) > > > > https://bugzilla.redhat.com/show_bug.cgi?id=705153 > > > I already said in comment 7, that due to changes in poppler 0.18, solution from > that bug is incorrect. Rafał, this fix has been committed for dev-python/python-poppler-0.12.1-r2 which is a solution for stable packages. The changes required for poppler-0.18.x will be considered separately. I have seen a patch for 0.18.x compat here: https://bugs.launchpad.net/poppler-python/+bug/776234 That will take some time to work out for pdfshuffler, I suspect, due to GDK pixbuf functions removal. Hopefully upstream has some ideas.
(In reply to comment #13) > Rafał, this fix has been committed for dev-python/python-poppler-0.12.1-r2 > which is a solution for stable packages. The changes required for > poppler-0.18.x will be considered separately. > > I have seen a patch for 0.18.x compat here: > https://bugs.launchpad.net/poppler-python/+bug/776234 > > That will take some time to work out for pdfshuffler, I suspect, due to GDK > pixbuf functions removal. Hopefully upstream has some ideas. There are a few gotchas: - poppler falls (mostly) under kde herd - at least as far as stabilization goes - and tends to get stabilized at most unfortunate moments - the "patch" you've mentioned simply removes those gdk functions (to be honest, just like it should), so it *will* break pdfshufler as it it now - as for pdfshuffler, patch from comment 7 is (AFAICT) complete in regard of gdk api removal (even if it needs a bit polish) - bug 377063 seems to be the last blocking bug 384885 ATM, so I wouldn't be surprised, if - given the status of python-poppler - it got ignored as soon as the herd decides poppler stabilization is desired
...I've meant "patch in comment 8", obviously.
(In reply to comment #14) > (In reply to comment #13) > > Rafał, this fix has been committed for dev-python/python-poppler-0.12.1-r2 > > which is a solution for stable packages. The changes required for > > poppler-0.18.x will be considered separately. > > > > I have seen a patch for 0.18.x compat here: > > https://bugs.launchpad.net/poppler-python/+bug/776234 > > > > That will take some time to work out for pdfshuffler, I suspect, due to GDK > > pixbuf functions removal. Hopefully upstream has some ideas. > > There are a few gotchas: > - poppler falls (mostly) under kde herd - at least as far as stabilization goes > - and tends to get stabilized at most unfortunate moments > Noted, I will put myself in that loop as necessary. > - the "patch" you've mentioned simply removes those gdk functions (to be > honest, just like it should), so it *will* break pdfshufler as it it now > Yep. But it fixes python-poppler correctly for poppler-0.18.x which is good. > - as for pdfshuffler, patch from comment 7 is (AFAICT) complete in regard of > gdk api removal (even if it needs a bit polish) > As far as the patch, I have not reviewed it. Here is the deal, that sort of patch needs to go upstream to the author of pdfshuffler. From the looks of his svn log he is responsive to contributions, so first thing to do is to try to get your patch upstream. Work with the author a bit to get the required fixes included in his next release. In the case that upstream does not want to incorporate appropriate code to fix this issue for forwards compatibility, then we may address alternative solutions then. I need this package, so its going to get fixed at one point or another. > - bug 377063 seems to be the last blocking bug 384885 ATM, so I wouldn't be > surprised, if - given the status of python-poppler - it got ignored as soon as > the herd decides poppler stabilization is desired I do not share your pessimism. Most often when things get ignored it's due to a lack of communication.
Created attachment 303647 [details, diff] more minimal poppler-0.18 compat This is a simplified version of attachment #292959 [details, diff]. I would like to just commit this: upstream svn does not have this bug (revision 60 fixes it, see sourceforge bug #3346212), but fixes it properly by using cairo ImageSurfaces instead of gdk Pixbufs throughout (and a custom cellrenderer to draw them). That is a change I think is too large to backport, and I think this fix is safe enough to use instead of a snapshot. If nobody objects I will commit this in a few days or so, as pdfshuffler is maintainer-needed. Many thanks to Rafał Mużyło for writing the patch this one is based on, but I really did not want to do the pixel format conversion by hand in Python, esp. without being able to test the bigendian case. This seems to get gdk to do it for us.
Will you remove the import traceback; traceback.print_exc() again?
I can, but that will lead to white/missing thumbnails with no indication of what went wrong if either the original code or my changes break. Note the added print is in an "except:" block that should not be hit at all unless there's already breakage. I'd prefer to keep it.
Okay, sounds good then; go ahead.
I've now committed this.