I want to write a python automation program for merge html files in a epub using ebook-edit(in MacOS sub directory) in calibre. I know how to do it manually but I want to it many epub files automatically in python. What should I do after the opening the epub file with ebook-edit?

import os, shlex, keyboard, time

from subprocess import Popen, PIPE

filename = 'test.epub'
command_line = '/Applications/calibre.app/Contents/MacOS/ebook-edit '+ '"'+ filename+ '"'
args = shlex.split(command_line)
p = Popen(args, stdin=PIPE)

2 Answers 2


You are better off noting that Calibre is a python app. First look at its command line options. Then if that is not enough create an addin or just code that uses calibre python code.

One way might be to zip the HTML files together and pass that as the input file to ebook-convert see calibre documentation https://manual.calibre-ebook.com/generated/en/ebook-convert.html#recipe-input-options


You might want to consider writing an Edit book plugin. For more information, see the e-book editing tools API documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.