View Single Post
Old 02-01-2026, 12:11 AM   #1263
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,802
Karma: 80104714
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Quote:
Originally Posted by Terisa de morgan View Post
I'm trying to solve the basic issues, I hope to have it working for calibre 8 and calibre 9 in some days.
It looks as if "imp" was deprecated in python 3.12; seeing calibre jumped from 3.11 to 3.14 imp is gone. pip does have zombie-imp (see https://pypi.org/project/zombie-imp/ )

Looks to be some discussion on how to replace it at https://github.com/python/cpython/issues/104212

And finally; the 3.12 release notes has some suggested code. See https://docs.python.org/dev/whatsnew/3.12.html#imp
Code:
import importlib.util
import importlib.machinery

def load_source(modname, filename):
    loader = importlib.machinery.SourceFileLoader(modname, filename)
    spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
    module = importlib.util.module_from_spec(spec)
    # The module is always executed and not cached in sys.modules.
    # Uncomment the following line to cache the module.
    # sys.modules[module.__name__] = module
    loader.exec_module(module)
    return module

Last edited by PeterT; 02-01-2026 at 12:26 AM.
PeterT is offline   Reply With Quote