Skip to content

Commit

Permalink
Make pycons/ishell.py compatible with Python 3 and current IPython
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmayo committed Apr 3, 2020
1 parent 2329c1c commit 6c086d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions gnucash/python/pycons/ishell.py
Expand Up @@ -16,12 +16,11 @@
import os
import sys
import re
from StringIO import StringIO
from io import StringIO
try:
import IPython
from IPython import ipapi
except Exception,e:
raise "Error importing IPython (%s)" % str(e)
except Exception as e:
raise Exception("Error importing IPython (%s)" % str(e))


# ------------------------------------------------------------------ class Shell
Expand Down Expand Up @@ -54,11 +53,11 @@ def __init__(self,argv=None,user_ns=None,user_global_ns=None,
header='IPython system call: ',
verbose=self.IP.rc.system_verbose)
# Get a hold of the public IPython API object and use it
self.ip = ipapi.get()
self.ip = IPython.core.getipython.get_ipython()
self.ip.magic('colors LightBG')
sys.excepthook = excepthook
self.iter_more = 0
self.complete_sep = re.compile('[\s\{\}\[\]\(\)]')
self.complete_sep = re.compile(r'[\s\{\}\[\]\(\)]')


def namespace(self):
Expand Down

0 comments on commit 6c086d1

Please sign in to comment.