Skip to content

cls command fails on Linux - should use IPython %clear magic #1152

@daym

Description

@daym

In src/mslice/widgets/ipythonconsole/ipython_widget.py, the cleanup() method executes cls (?) in ipython to clear the console:

  def cleanup(self):
      if in_mantid():
          self.execute("cls")
          self.execute("import mslice.cli as mc")

This causes a NameError because IPython tries to evaluate it as Python code (variable reference to variable cls):

NameError                                 Traceback (most recent call last)
  Cell In[2], line 1
  ----> 1 cls

Why not just use self.clear() ?

Environment:

  • mslice version: 2.13
  • OS: Linux
  • File: src/mslice/widgets/ipythonconsole/ipython_widget.py

To reproduce:

  1. Open mantid
  2. Open mslice
  3. Close mslice
  4. Open mslice
  5. See error message

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions