This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: ValueError; Completions not working right on macOS
Type: Stage: resolved
Components: IDLE, macOS Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE: problems with completions on Mac
View: 41611
Assigned To: terry.reedy Nosy List: ned.deily, rhettinger, ronaldoussoren, terry.reedy
Priority: normal Keywords:

Created on 2020-09-25 04:12 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg377479 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-09-25 04:12
I found this in today's long running shell session.  The trigger event isn't known.

Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1885, in __call__
    return self.func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py", line 176, in handler
    r = l[i](event)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py", line 430, in keyrelease_event
    self.hide_window()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py", line 447, in hide_window
    self.widget.event_delete(HIDE_VIRTUAL_EVENT_NAME, seq)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py", line 392, in event_delete
    triplets.remove(triplet)
ValueError: list.remove(x): x not in list
msg377481 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-25 05:25
I presume that at some point you got a completion box.  It disappeared with this traceback and when >>> appeared, you continued.  What python binary? 3.8.5?  3.8.6? My diagnosis so far.

__call__ is a method in CallWrapper.  The wrapped func is multicall.handler.  The exception was caught in the
    except: self.widget._report_exception()
clause of __call__, but it should never have been raised.

keyrelease_event catches internal errors.  If the insert cursor is not where IDLE expects, because "# we didn't catch an event which moved the insert", IDLE just closes box rather than trying to recover.  I presume that this should never happen.  But when it did, a ValueError was raised for the reason given.  In this error state, multicall.event_delete makes an invalid assumption.

The simple and immediate fix would be to catch the very rare delete failure.  A better and harder fix would be to catch the uncaught insert-moving event. For this, it would have been nice if keyrelease displayed a message identifying the released key with an email request.  I should  try to reproduce the failure (including on Mac) by trying every key (or type of key) that might possibly move the cursor.
msg377494 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-09-25 17:01
> What python binary?

This is from the 64-bit macOS build on python.org:

    $ python3.9
    Python 3.9.0rc2 (v3.9.0rc2:2bd31b5fde, Sep 16 2020, 20:19:18)
    [Clang 6.0 (clang-600.0.57)] on darwin

Thanks for looking into this :-)

Let me know if filing these issues is helpful to you.  I log a couple thousand hours of heavy IDLE usage each year and my students really put the tool through its paces.  We tend to uncover buglets that wouldn't surface in light testing.  At the end of the day, if there are tracebacks I haven't seen before, I'm posting them here.  Hopefully, they are useful.
msg377519 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-26 06:54
On Windows, the only key I found that closed the completion box via keyrelease_event is Left Arrow.  If I explicitly caught that, the method might not be needed on Windows.  Next I will look at the triplets list and how something might be missing or deleted twice.

On my Mac Airbook with current 3.8.6 and 3.9.0rc2, I cannot get a completion box, even with the menu.  Do you have the same issue?

Reports with a traceback, like this one, are helpful and welcome.  If possible, include and information about either the code or action that triggered the exception.
msg377601 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-28 15:14
Reports with a reproducer are also helpful.

Again, can you get a completion box at all?
msg377733 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-10-01 02:33
I don't have a reproducer.  The event occurred one in a full-day session.

I don't get a completion box.
msg387394 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-20 06:36
This seemingly random error involved completions and there is already an issue about them not working right on macOS.  It was also opened by Raymond as a result of another 'random' error in an all day session.
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86025
2021-02-20 06:36:16terry.reedysetstatus: open -> closed

superseder: IDLE: problems with completions on Mac
components: + macOS
title: Uncaught ValueError -> IDLE: ValueError; Completions not working right on macOS
nosy: + ronaldoussoren, ned.deily

messages: + msg387394
resolution: duplicate
stage: resolved
2020-10-21 01:20:38terry.reedysetnosy: - patanjalisutra666
2020-10-21 01:20:24terry.reedysetfiles: - debian-desktop.png
2020-10-21 01:19:48terry.reedysetmessages: - msg377737
2020-10-01 05:51:43patanjalisutra666setfiles: + debian-desktop.png
nosy: + patanjalisutra666
messages: + msg377737

2020-10-01 02:33:10rhettingersetmessages: + msg377733
2020-09-28 15:14:10terry.reedysetmessages: + msg377601
2020-09-26 06:54:53terry.reedysetmessages: + msg377519
2020-09-25 17:01:00rhettingersetmessages: + msg377494
2020-09-25 05:25:40terry.reedysetmessages: + msg377481
2020-09-25 04:12:05rhettingercreate