mirror of https://github.com/secdev/scapy.git
Merge pull request #1020 from gpotter2/ipython-old
Support old IPython versions
This commit is contained in:
commit
8857f01511
|
@ -502,10 +502,13 @@ def interact(mydict=None,argv=None,mybanner=None,loglevel=20):
|
|||
"traitlets not available. Some Scapy shell features won't be "
|
||||
"available."
|
||||
)
|
||||
ipshell = InteractiveShellEmbed(
|
||||
banner1=banner,
|
||||
user_ns=SESSION,
|
||||
)
|
||||
try:
|
||||
ipshell = InteractiveShellEmbed(
|
||||
banner1=banner,
|
||||
user_ns=SESSION,
|
||||
)
|
||||
except:
|
||||
code.interact(banner = the_banner, local=SESSION)
|
||||
else:
|
||||
cfg = Config()
|
||||
try:
|
||||
|
@ -518,10 +521,20 @@ def interact(mydict=None,argv=None,mybanner=None,loglevel=20):
|
|||
cfg.TerminalInteractiveShell.separate_in = u''
|
||||
cfg.TerminalInteractiveShell.hist_file = conf.histfile
|
||||
# configuration can thus be specified here.
|
||||
ipshell = InteractiveShellEmbed(config=cfg,
|
||||
banner1=banner,
|
||||
hist_file=conf.histfile if conf.histfile else None,
|
||||
user_ns=SESSION)
|
||||
try:
|
||||
ipshell = InteractiveShellEmbed(config=cfg,
|
||||
banner1=banner,
|
||||
hist_file=conf.histfile if conf.histfile else None,
|
||||
user_ns=SESSION)
|
||||
except (AttributeError, TypeError):
|
||||
log_loading.warning("IPython too old. Won't support history and color style.")
|
||||
try:
|
||||
ipshell = InteractiveShellEmbed(
|
||||
banner1=banner,
|
||||
user_ns=SESSION,
|
||||
)
|
||||
except:
|
||||
code.interact(banner = the_banner, local=SESSION)
|
||||
ipshell(local_ns=SESSION)
|
||||
else:
|
||||
code.interact(banner = the_banner, local=SESSION)
|
||||
|
|
|
@ -296,7 +296,7 @@ def apply_ipython_style(shell):
|
|||
except:
|
||||
from scapy.error import log_loading
|
||||
log_loading.warning(
|
||||
"IPython too old. Some Scapy shell features won't be available."
|
||||
"IPython too old. Shell color won't be handled."
|
||||
)
|
||||
return
|
||||
from scapy.config import conf
|
||||
|
|
Loading…
Reference in New Issue