From 03b7feb50736d6fe27f2639afd2747ec2187290c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jun 2021 19:47:54 +0530 Subject: [PATCH] Avoid ipython repeated exception when not available --- src/calibre/utils/ipython.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/utils/ipython.py b/src/calibre/utils/ipython.py index 59417d2d91..cd95ace936 100644 --- a/src/calibre/utils/ipython.py +++ b/src/calibre/utils/ipython.py @@ -187,11 +187,14 @@ def simple_repl(user_ns={}): def ipython(user_ns=None): os.environ['IPYTHONDIR'] = ipydir + have_ipython = True try: from IPython.terminal.embed import InteractiveShellEmbed from traitlets.config.loader import Config from IPython.terminal.prompts import Prompts, Token except ImportError: + have_ipython = False + if not have_ipython: return simple_repl(user_ns=user_ns) class CustomPrompt(Prompts):