FYI: I'm going to retire the cursesGui plugin

49 views
Skip to first unread message

Edward K. Ream

unread,
May 10, 2026, 8:49:16 AM (11 days ago) May 10
to leo-editor
​The cursesGui plugin was a precursor to the much more capable cursersGui2 plugin. While working on PR #4674, I started to wonder about the status of the older plugin.

​A quick review of the cursesGui plugin showed it would need a lot of work to become functional. Earlier this morning, I created PR #4676 to record my investigations. Almost immediately, I closed this PR: there is no chance that the cursesGui plugin will ever again be useful. If it ever was. Indeed, the cursesGui plugin was probably based on Leo's long-defunct Tk gui!!

I plan to move cursesGui.py to Leo's permanent attic. Imo, this code should not even be considered to be obsolete. It's just useless. I don't want to tempt anyone else to waste a minute more on it.

Your comments, please.

Edward

Edward K. Ream

unread,
May 10, 2026, 9:05:19 AM (11 days ago) May 10
to leo-editor
On Sunday, May 10, 2026 at 7:49:16 AM UTC-5 Edward K. Ream wrote:

> I plan to move cursesGui.py to Leo's permanent attic. Imo, this code should not even be considered to be obsolete. It's just useless. I don't want to tempt anyone else to waste a minute more on it.

PR #4677 does the work.

Edward

Viktor Ransmayr

unread,
May 11, 2026, 5:17:09 AM (10 days ago) May 11
to leo-editor
Hello Edward,

What is the status of issue #4625 ?

Should I report issues for Linux - or - is it still to early from your point of view ?

With kind regards,

Viktor

Edward K. Ream

unread,
May 11, 2026, 6:28:47 AM (10 days ago) May 11
to leo-e...@googlegroups.com
On Mon, May 11, 2026 at 4:17 AM Viktor Ransmayr wrote:

> What is the status of issue #4625 ?

PR #4674 is ready for review. Please report any issues with that PR.

Thanks.

Edward

Viktor Ransmayr

unread,
May 11, 2026, 7:51:31 AM (10 days ago) May 11
to leo-editor
Hello Edward,

I did test the '--gui=console' option both in a fresh Debian - as well as - Fedora Test VM.

Here's the first report of a traceback for Debian 13.

With kind regards,

Viktor

###

    user@Test-VM04:~$
    user@Test-VM04:~$ cd projects/.venv
    user@Test-VM04:~/projects/.venv$
    user@Test-VM04:~/projects/.venv$ source bin/activate
    (.venv) user@Test-VM04:~/projects/.venv$
    (.venv) user@Test-VM04:~/projects/.venv$ cd leo-editor/
    (.venv) user@Test-VM04:~/projects/.venv/leo-editor$
    (.venv) user@Test-VM04:~/projects/.venv/leo-editor$ python3 -m leo.core.runLeo --gui=console
    setting leoID from os.getenv('USER'): 'user'
    Leo 6.8.9-devel, devel branch, April 14, 2026
    Python 3.13.5, Leo Console Gui (npyscreen)
    linux
    SessionManager.load_snapshot: no previous session

    Uncaught exception in Leo...
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/home/user/projects/.venv/leo-editor/leo/core/runLeo.py", line 128, in <module>
        run()
        ~~~^^
      File "/home/user/projects/.venv/leo-editor/leo/core/runLeo.py", line 112, in run
        g.app.loadManager.load(fileName, pymacs)
        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/.venv/leo-editor/leo/core/leoApp.py", line 2393, in load
        g.app.gui.runMainLoop()
        ~~~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/.venv/leo-editor/leo/plugins/cursesGui2.py", line 1681, in runMainLoop
        self.curses_app.run()  # run calls CApp.main(), which calls CGui.run().
        ~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 47, in run
        return npyssafewrapper.wrapper(self.__remove_argument_call_main)
               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 52, in wrapper
        wrapper_no_fork(call_function)
        ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
      File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 101, in wrapper_no_fork
        locale.setlocale(locale.LC_ALL, '')
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.13/locale.py", line 615, in setlocale
        return _setlocale(category, locale)
    locale.Error: unsupported locale setting

    (.venv) user@Test-VM04:~/projects/.venv/leo-editor$

###
 

Viktor Ransmayr

unread,
May 11, 2026, 7:54:25 AM (10 days ago) May 11
to leo-editor
Hello Edward,

Edward K. Ream schrieb am Montag, 11. Mai 2026 um 12:28:47 UTC+2:
Here's the second report for a different traceback on Fedora 43, which allows the installation of Leo outside of a Python Virtual Environment (venv).

With kind regards,

Viktor

###

    [user@Test-VM03 leo-editor]$
    [user@Test-VM03 leo-editor]$ python -m leo.core.runLeo &
    [1] 1136
    [user@Test-VM03 leo-editor]$ setting leoID from os.getenv('USER'): 'user'

    Leo 6.8.9-devel, devel branch, April 14, 2026
    Python 3.14.4, PyQt version 6.11.0

    linux
    SessionManager.load_snapshot: no previous session
    creating: /home/user/.leo/.leoRecentFiles.txt

    [1]+  Done                       python -m leo.core.runLeo
    [user@Test-VM03 leo-editor]$
    [user@Test-VM03 leo-editor]$ python -m leo.core.runLeo --gui=console

    setting leoID from os.getenv('USER'): 'user'
    Leo 6.8.9-devel, devel branch, April 14, 2026
    Python 3.14.4, Leo Console Gui (npyscreen)

    linux
    SessionManager.load_snapshot: no previous session

    Uncaught exception in Leo...
    Traceback (most recent call last):
      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 1681, in runMainLoop

        self.curses_app.run()  # run calls CApp.main(), which calls CGui.run().
        ~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 47, in run
        return npyssafewrapper.wrapper(self.__remove_argument_call_main)
               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 52, in wrapper
        wrapper_no_fork(call_function)
        ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 116, in wrapper_no_fork
        return_code = call_function(_SCREEN)
      File "/home/user/projects/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 40, in __remove_argument_call_main
        return self.main()
               ~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 2845, in main
        g.app.gui.run()
        ~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 1695, in run
        self.top_form = self.createCursesTop()
                        ~~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 1401, in createCursesTop
        self.curses_form = form = LeoForm(name='Dummy Name')  # This call clears the screen.
                                  ~~~~~~~^^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/fmForm.py", line 58, in __init__
        super(_FormBase, self).__init__(*args, **keywords)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/proto_fm_screen_area.py", line 100, in __init__
        self._create_screen()
        ~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/proto_fm_screen_area.py", line 113, in _create_screen
        self.lines = self._max_physical()[0] + 1
                     ~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/external/npyscreen/proto_fm_screen_area.py", line 138, in _max_physical
        'hh', fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, 'xxxx')
              ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SystemError: buffer overflow

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/home/user/projects/leo-editor/leo/core/runLeo.py", line 128, in <module>
        run()
        ~~~^^
      File "/home/user/projects/leo-editor/leo/core/runLeo.py", line 112, in run
        g.app.loadManager.load(fileName, pymacs)
        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
      File "/home/user/projects/leo-editor/leo/core/leoApp.py", line 2393, in load
        g.app.gui.runMainLoop()
        ~~~~~~~~~~~~~~~~~~~~~^^
      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 1686, in runMainLoop
        curses.endwin()
        ~~~~~~~~~~~~~^^
    _curses.error: endwin() returned ERR

    [user@Test-VM03 leo-editor]$

###
 

Edward K. Ream

unread,
May 11, 2026, 11:08:31 AM (10 days ago) May 11
to leo-e...@googlegroups.com
On Mon, May 11, 2026 at 6:51 AM Viktor Ransmayr  wrote:

> I did test the '--gui=console' option both in a fresh Debian - as well as - Fedora Test VM.

Thanks for your testing. I tested Leo's console gui on Ubuntu.  Everything worked for me except that Leo reported multiple errors during shutdown, after correctly executing Leo's quit-leo command. Those errors were the result of Leo calling sys.exit(0). That would be a separate issue, but I don't much care about the tracebacks.

In short, the PR #4674 appears to do what it's supposed to do. I'm going to merge it.

Now to your specific reports.

> Here's the first report of a traceback for Debian 13.
QQQ

Uncaught exception in Leo...
Traceback (most recent call last):

[snip]

File "/home/user/projects/.venv/leo-editor/leo/core/leoApp.py", line 2393, in load
  g.app.gui.runMainLoop()
  ~~~~~~~~~~~~~~~~~~~~~^^
File "/home/user/projects/.venv/leo-editor/leo/plugins/cursesGui2.py", line 1681, in runMainLoop
  self.curses_app.run()  # run calls CApp.main(), which calls CGui.run().
  ~~~~~~~~~~~~~~~~~~~^^
File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 47, in run
  return npyssafewrapper.wrapper(self.__remove_argument_call_main)
         ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 52, in wrapper
  wrapper_no_fork(call_function)
  ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/home/user/projects/.venv/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 101, in wrapper_no_fork
  locale.setlocale(locale.LC_ALL, '')
  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/locale.py", line 615, in setlocale
  return _setlocale(category, locale)
      locale.Error: unsupported locale setting

QQQ

The cursesGui2.py plugin doesn't mess with locale settings. This must be an npyscreen issue of some kind.

Your other crash was also interesting:

QQQ
SystemError: buffer overflow
    During handling of the above exception, another exception occurred:
[Snip]

      File "/home/user/projects/leo-editor/leo/plugins/cursesGui2.py", line 1686, in runMainLoop
        curses.endwin()
        ~~~~~~~~~~~~~^^
    _curses.error: endwin() returned ERR

QQQ

This is the last part of the traceback that I say. To repeat, sys.exit(0) caused it. The cursesGui2 plugin is mostly blameless.

HTH.

Edward
Reply all
Reply to author
Forward
0 new messages