question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sorry, AREPL has ran into an error - probably macOS

See original GitHub issue

Describe the bug

Sorry, AREPL has ran into an error

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 261, in _add_reader
    key = self._selector.get_key(fd)
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 193, in get_key
    raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '5 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jb/.vscode/extensions/almenon.arepl-2.0.2/node_modules/arepl-backend/python/arepl_python_evaluator.py", line 298, in main
    return_info = exec_input(execArgs)
  File "/Users/jb/.vscode/extensions/almenon.arepl-2.0.2/node_modules/arepl-backend/python/arepl_python_evaluator.py", line 234, in exec_input
    asyncio.set_event_loop(asyncio.new_event_loop())
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 761, in new_event_loop
    return get_event_loop_policy().new_event_loop()
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 659, in new_event_loop
    return self._loop_factory()
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 54, in __init__
    super().__init__(selector)
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 61, in __init__
    self._make_self_pipe()
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 112, in _make_self_pipe
    self._add_reader(self._ssock.fileno(), self._read_from_self)
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 263, in _add_reader
    self._selector.register(fd, selectors.EVENT_READ,
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 523, in register
    self._selector.control([kev], 0, 0)
TypeError: changelist must be an iterable of select.kevent objects

Print Output:
Exception ignored in: <function BaseEventLoop.__del__ at 0x11871de50>
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 683, in __del__
    self.close()
  File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 60, in close
    for sig in list(self._signal_handlers):
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_signal_handlers'

To Reproduce Try typing a small program. Probably triggerable by any use of macOS and AREPL when typing a variable name that does not exist yet.

Screenshots If applicable, add screenshots to help explain your problem.

Other Information (please complete the following information):

  • OS: macOS Mojave
  • Python Version 3.9.2_4 Homebrew

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
BrandonNavcommented, Apr 29, 2021

What about

from sys import version
print(version)
import asyncio
asyncio.set_event_loop(asyncio.new_event_loop())
asyncio.set_event_loop(asyncio.new_event_loop())

?

I managed to get this working by changing https://github.com/Almenon/AREPL-backend/blob/master/python/arepl_python_evaluator.py#L234

from asyncio.set_event_loop(asyncio.new_event_loop())

to asyncio.set_event_loop(asyncio.get_event_loop())

My environment: MacOS 11.2.3 (Big Sur) Python 3.9.3

0reactions
Almenoncommented, May 31, 2022

Finally got access to a Mac. I can reproduce the bug on 3.9, but the bug does not occur on 3.10. I suggest either using the fix workaround above, downgrading to 3.7, or upgrading to 3.10.

The other interesting thing is that for me this only occurs in the third arepl run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

arepl/Lobby - Gitter
Hey guys I'm getting this weird error in VSCode when trying to use both the python debugger and AREPL: Print Output:
Read more >
AREPL for python - Visual Studio Marketplace
AREPL automatically evaluates python code in real-time as you type. ... First, make sure you have python 3.7 or greater installed.
Read more >
AREPL extension error in VSCode with Python 3.7
I have just switched to VSCode for Python development and have installed the AREPL extension. Upon activating the extension, ...
Read more >
VS Code - Pawel Cislo
Back in 2018 while publishing this blog, I was slowly immersing in the use ... your objective is to guess what is its...
Read more >
Inventures Almanach by TOSA Publishing - Issuu
And not because we have to, but because we want to: This almanach was ... Cbinsights: “Venture Capital Financing & Exits Hit 2001 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found