TypeError: __init__() got an unexpected keyword argument 'uid'
d-vyd opened this issue · 3 comments
As long as Python finds the image to be inserted, I get the error:
img = epub.EpubImage(uid='image_1', file_name='static/ebooklib.gif', media_type='image/gif', content=image_content)
TypeError: init() got an unexpected keyword argument 'uid'
This even happens with the image creation example. If I remove the "uid" keyword argument, it complains that "file_name" is unexpected. What might be causing this error? I'm using Python 3.7.9 64 bit on Windows.
I ran into the same problem. Taking a look a the source code for the EpubImage class, seems the constructor doesn’t implement these parameters while other classes like EpubNav do. Maybe an oversight? Anyway, a workaround is assigning the member variables manually after creating the object:
image = epub.EpubImage()
image.uid='image_1'
image.file_name='static/ebooklib.gif'
image.media_type='image/gif'
image.content=image_content
The version PyPi seems wildly outdated compared to the documentation. It's really difficult to follow the docs because every single one of the examples throws errors
It was an oversight. Has been fixed in the development branch but not officially released. Will release new version this week and until then you can use development branch.