booxtream-epub-drm-remover icon indicating copy to clipboard operation
booxtream-epub-drm-remover copied to clipboard

AttributeError: 'NoneType' object has no attribute 'attrs'

Open Falcon-1 opened this issue 8 years ago • 6 comments

I'm unable to run the script on Ubuntu 16.10:

$ python -V
Python 2.7.12+
$ python cure.py -i test.epub -o out.epub
Curing test.epub ...
[parseContainer] Found entrypoint to ePub: OPS/content.opf


 === Removing 'Ex Libris' watermark (WM0) === 


OPS/content.opf
Traceback (most recent call last):
  File "cure.py", line 318, in <module>
    main(sys.argv[1:])
  File "cure.py", line 306, in main
    wm0(entry)
  File "cure.py", line 49, in wm0
    exlibris_filename =  dict(exlibris.attrs)[u'href']
AttributeError: 'NoneType' object has no attribute 'attrs'

Falcon-1 avatar Nov 12 '16 12:11 Falcon-1

Thanks for reporting - could you send me the epub file you tested the script with? My email is in my profile.

grayleonard avatar Nov 13 '16 23:11 grayleonard

Hey grayleonard,

Just to let you know I ran into the exact same issue today - using macOs Sierra 10.12.4.

Went through some pain to make the correct version of python and the needed dependencies work altogether on my mac (py version = 2, imagemagick 6.9 and not 7) ; now I am all set, but same bug as previously mentioned by falcon-1. Let me know if you want me to send you the epub file I have for testing.

my2cents : in OEBPS/content.opf, there ain't no tag with id "exlibris".

Digging further, the watermarks in the file I have don't fit what's described... I'll try and remove the sneaky data myself by hand before uploading... For your record : in the Text folder files (xhtml) at the end : <p(...)>Tirage n° [email protected]</p>

and

<!-- customer .... + timestamp + -->

Thanks for the tool anyway!

l0new4nder3r avatar Apr 09 '17 14:04 l0new4nder3r

Ah interesting, thanks for the description @l0new4nder3r. There's no error handling in the script, and I imagine new .epubs have slighly different DRM methods that throw off the script. My email is in my profile, thanks for offering to send it over!

grayleonard avatar Apr 09 '17 15:04 grayleonard

No worries, I thought so (even tho I dunno much about python, I am a java dev). I think that this one ebook has no proper drm, only watermarks to track who bought the book - why I fell on you github anyway :-)

Mail coming in a few, thx for the answer!

l0new4nder3r avatar Apr 09 '17 15:04 l0new4nder3r

Got it, taking a look now.

grayleonard avatar Apr 09 '17 15:04 grayleonard

Hey @l0new4nder3r - just pushed e6923b2, and your file should be handled correctly. However, the file you sent has different protections -- doesn't seem like it uses Booxtream.

grayleonard avatar Apr 10 '17 17:04 grayleonard