View Single Post
Old 06-14-2014, 11:17 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,411
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I suggest you stick to using the html5lib that ships with calibre. It has many improvements over the vanilla html5lib. See https://github.com/html5lib/html5lib-python/issues/119

As for the general issue of using python packages in plugins, you have two approaches:

1) manipulate sys.path, simply unmanipulate it after you are done importing to ensure that it does not cause problems with the rest of calibre.

2) Modify the python files in the package you are bundling to import its submodules from the calibre_plugins namespace

-----

1) is quick and dirty and will cause problems if the modules you are importing shadow modules that are part of calibre

2) Is much more robust, but requires a little work.
kovidgoyal is offline   Reply With Quote