View Single Post
Old 10-08-2017, 02:49 PM   #3
botmtl
Enthusiast
botmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel is
 
botmtl's Avatar
 
Posts: 43
Karma: 70238
Join Date: Jun 2014
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Code:
from calibre.ebooks.metadata.opf import get_metadata
get_metadata(open('/t/p/input/index.opf'))[0]
Thank you!

I finally found where everything goes wrong ... but I have no idea why. Running this works fine:
Code:
get_metadata(open('d:\\1.mi'))[0]
but this (raw string) fails:
Code:
get_metadata(open(r'd:\1.mi'))[0]
with
Code:
  File "<console>", line 1, in <module>
  File "site-packages\calibre\ebooks\metadata\opf.py", line 44, in get_metadata
  File "site-packages\calibre\ebooks\metadata\opf.py", line 37, in get_metadata_from_parsed
  File "site-packages\calibre\ebooks\metadata\opf.py", line 27, in get_metadata2
  File "site-packages\calibre\ebooks\metadata\opf2.py", line 640, in to_book_metadata
  File "site-packages\calibre\ebooks\metadata\__init__.py", line 337, in MetaInformation
  File "site-packages\calibre\ebooks\metadata\book\base.py", line 90, in __init__
  File "site-packages\calibre\ebooks\metadata\book\base.py", line 475, in smart_update
TypeError: 'list' object is not callable
Any idea why? It's so strange, i'm sure i have used the r'strings' before for paths.. Fals seem to happen on I18n stuff (it's mistakenly thinking that _ is a call object thing instead of translation stuff).

Last edited by botmtl; 10-08-2017 at 02:52 PM.
botmtl is offline   Reply With Quote