calibreのPythonコードを書こうとしてつまづいたところ。

calibreはインストールしたのになぜかPythonでimportできない、というのにつまづきました。

>>> import calibre
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named calibre

なんでかなと思ったら、init_calibreをまずimportしないといけいなかったみたいです。

>>> import init_calibre
>>> import calibre

よく見ると、マニュアルにもちゃんと書いてありました。

It is essential that you import the init_calibre module before any other calibre modules/packages as it sets up the interpreter to run calibre code.

Setting up a calibre development environment — calibre User Manual

calibreのレシピに書くときは、calibre本体がinit_calibre的なことをしてくれるので不要っぽい。