Skip to content

Commit

Permalink
Fix for the gf shell. Supports newer versions of IPython, v3.11+ (#414)
Browse files Browse the repository at this point in the history
IPython.terminal broke the greatfet shell such that any attempt to use it resulted in an exception ending in:
Exception 'NoneType' object has no attribute 'check_complete'

This was traced to a change in IPython, version 8.11 and has broken other projects as well, refer to this issue in the IPython project: ipython/ipython#13966

This PR fixes the problem, as suggested in the issue report (linked above). It should be compatible with IPython v8.11 and later, and also backwards compatible for earlier versions of the library as well (as per the above issues last comment).

I tested the raw Python script (greatefet_shell.py) but have not managed to generate an install (.egg ?) using the README instructions. The .py file, when run directly, no longer creates an exception and the shell runs normally.
  • Loading branch information
RichardEWillis authored May 5, 2023
1 parent 4d56571 commit 2409575
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions host/greatfet/commands/greatfet_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from greatfet.util.interactive import GreatFETShellMagics

import IPython
from IPython.terminal.interactiveshell import TerminalInteractiveShell

def main():

Expand Down Expand Up @@ -69,7 +68,10 @@ def main():


# Create a new shell, and give it access to our created GreatFET object.
shell = TerminalInteractiveShell()
if IPython.core.getipython.get_ipython() is None:
shell = IPython.terminal.embed.InteractiveShellEmbed.instance()
else:
shell = IPython.terminal.embed.InteractiveShellEmbed()
shell.push('gf')

# Create nice aliases for our primary interfaces.
Expand Down

0 comments on commit 2409575

Please sign in to comment.