mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Avoid ipython repeated exception when not available
This commit is contained in:
parent
a37c14499c
commit
03b7feb507
@ -187,11 +187,14 @@ def simple_repl(user_ns={}):
|
|||||||
|
|
||||||
def ipython(user_ns=None):
|
def ipython(user_ns=None):
|
||||||
os.environ['IPYTHONDIR'] = ipydir
|
os.environ['IPYTHONDIR'] = ipydir
|
||||||
|
have_ipython = True
|
||||||
try:
|
try:
|
||||||
from IPython.terminal.embed import InteractiveShellEmbed
|
from IPython.terminal.embed import InteractiveShellEmbed
|
||||||
from traitlets.config.loader import Config
|
from traitlets.config.loader import Config
|
||||||
from IPython.terminal.prompts import Prompts, Token
|
from IPython.terminal.prompts import Prompts, Token
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
have_ipython = False
|
||||||
|
if not have_ipython:
|
||||||
return simple_repl(user_ns=user_ns)
|
return simple_repl(user_ns=user_ns)
|
||||||
|
|
||||||
class CustomPrompt(Prompts):
|
class CustomPrompt(Prompts):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user