dsanson / termpdf.py

A graphical pdf and epub reader that works inside the kitty terminal
MIT License
496 stars 30 forks source link

getTextBlocks() got an unexpected keyword argument 'images' #4

Closed teto closed 4 years ago

teto commented 4 years ago

I have packaged termpdf for my distrib and am playing a bit with it. When pressing 'c' (crop), termpdf crashes with:

                                                                                                                                           File "/nix/store/3nk3v48b1nn1kb0q1ys9xskn7s6jkm7v-termpdf.py-2019-09-30/bin/.termpdf.py-wrapped", line 1479, in view
                                                                                                   doc.display_page(bar,doc.page)
                                                                                                                                   File "/nix/store/3nk3v48b1nn1kb0q1ys9xskn7s6jkm7v-termpdf.py-2019-09-30/bin/.termpdf.py-wrapped", line 600, in display_page
                                                                                                  crop = self.auto_crop(page)
                                                                                                                               File "/nix/store/3nk3v48b1nn1kb0q1ys9xskn7s6jkm7v-termpdf.py-2019-09-30/bin/.termpdf.py-wrapped", line 580, in auto_crop
                                                                                           blocks = page.getTextBlocks(images=True)
                                                                                                                                   TypeError: getTextBlocks() got an unexpected keyword argument 'images'
dsanson commented 4 years ago

Looks like pymupdf removed support for the images flag in the getTextBlocks() function. I just pushed a quick fix: 9e5ee6d4ebfd16343c231762c2ccd2beb8831847 But this will have the bad consequence that images are ignored when autocropping!

rien333 commented 4 years ago

Wait, @teto, are you using Linux? I can't get termpdf.py to work on my Arch Linux system, see https://github.com/dsanson/termpdf.py/issues/2. If you're running linux, it's probably just a dependency problem on my part.

teto commented 4 years ago

@rien333 yes I am on linux, you can have a look at my package https://github.com/NixOS/nixpkgs/pull/69637/files to see the dependencies I use. I know at least one person using termpdf.py on arch so that must be sthg in your config. Try reinstalling with the new setup.py (it used to lack dependencies).

rien333 commented 4 years ago

(python-)dependencies don't seem to be the issue, but it's a bug that might be specific to kitty, see #2. What version of kitty are you running @teto ?

teto commented 4 years ago

0.14.3

dsanson commented 4 years ago

FWIW, @rien333, I am using fish, though I am on a Mac.