curses.has_key._capability_names missing on systems without native _curses.has_key
See original GitHub issueI’ve downloaded Blessed 1.15.0 on the HP-UX-B.11.31-ia64-32bit
build of Python 2.7.13. The following code generates the following traceback:
>>> from blessed import Terminal
>>> term = Terminal()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/self/.local/lib/python2.7/site-packages/blessed/terminal.py", line 229, in __init__
self.__init__keycodes()
File "/home/self/.local/lib/python2.7/site-packages/blessed/terminal.py", line 277, in __init__keycodes
self._keymap = get_keyboard_sequences(self)
File "/home/self/.local/lib/python2.7/site-packages/blessed/keyboard.py", line 174, in get_keyboard_sequences
capability_names = curses.has_key._capability_names
AttributeError: 'function' object has no attribute '_capability_names'
The object curses.has_key
is a function
with only the usual attributes; no single-underscore attributes are present.
I believe the problem is caused by my _curses
module not exporting the has_key
function, and therefore exports the curses.has_key.has_key
function instead. Because the module and function have the same name, the has_key
module is not accessible. The following is from my curses/__init__.py
:
# Import Python has_key() implementation if _curses doesn't contain has_key()
try:
has_key
except NameError:
from has_key import has_key
Because has_key.has_key
is a function, this makes has_key._capability_names
inaccessible.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
blessed.keyboard — Blessed 1.19.0 documentation
A small gem from curses.has_key that makes this all possible, # _capability_names: a lookup table of terminal capability names for # keyboard sequences...
Read more >Error no module named curses - python - Stack Overflow
It allows python's native curses to be used on Windows, so all your standard python curses code can be used. Share.
Read more >ncurses/NEWS at gittup · gittup/ncurses - GitHub
This is a log of changes that ncurses has gone through since Zeyd started ... + suppress a warning message (which is ignored)...
Read more >NEWS - platform/external/ncurses - android Git repositories
> fix several errata in tic (reports/testcases by "zjuchenyuan"): + check for invalid hashcode in _nc_find_entry. + check for missing character after ...
Read more >Change-Log for NCURSES - Thomas E. Dickey
+ update ncurses-howto, more documentation fixes along with corrections to ... + use NQ to flag entries where the terminal does not support...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jquast Sounds like we can use the logic in #110
blessed/keyboard.py
(minus the platform test) andblessed/tests/test_keyboard.py
to fix this universally. It’s basically moving the import to the top of the file and fixing up a monkeypatch in the tests.we use the code pattern you suggest, so i suggest this is resolved