0

Having newly installed windows-curses (and restarted VS Code), I am attempting to write a context manager to abstract away curses.initscr() and curses.endwin(). However, in the problems pane, Pylint keeps throwing this error: Module 'curses' has no 'endwin' member. The file runs without a problem. Why might this be happening? Does it indicate a problem, or should I just turn it off?

Currently discovered members Pylint claims are missing:

  • endwin
  • error
  • napms

Update: Adding this code:

"python.linting.pylintArgs": [
        "--extension-pkg-whitelist=curses"
    ]

to settings.json changed nothing.

Lyndon Gingerich
  • 604
  • 7
  • 17
  • how are these methods defined in the .py file? Can it be statically analyzed? – rioV8 May 02 '21 at 03:04
  • @rioV8 I don't understand the question. Could you clarify? – Lyndon Gingerich May 02 '21 at 03:10
  • go to the `windows-curses` py file and find the `endwin` method – rioV8 May 02 '21 at 10:45
  • @rioV8 All I'm finding for `windows-curses` is distribution information; I figured it would be defined under `curses`, but I can't find it there, either. I'm looking in `c:\users\\appdata\local\programs\python\python39\lib\curses\`. – Lyndon Gingerich May 03 '21 at 14:44
  • can you find the `initscr` method? Then also look for the `endwin` method in the same module – rioV8 May 03 '21 at 14:53
  • @rioV8 I think I discovered the reason for its obscurity. `curses` is a C library. The Python `curses` library provides an interface thereto, and `windows-curses` ports that to Windows. Therefore, these members are probably defined in a C file somewhere, not in Python. – Lyndon Gingerich May 03 '21 at 15:15
  • @rioV8 [Here](https://github.com/mirror/ncurses/blob/master/ncurses/base/lib_endwin.c) is a mirror of the `ncurses` source where `endwin()` is defined. – Lyndon Gingerich May 03 '21 at 15:24
  • if you can call `endwin` from a Python script there has to be a definition of this function, statically coded or dynamic constructed – rioV8 May 03 '21 at 16:31
  • @rioV8 Where else should I look? I'm not finding it. – Lyndon Gingerich May 03 '21 at 17:36

1 Answers1

1

windows-curses supplies _curses, so you'll want to use pass the flag --extension-pkg-allow-list=_curses to pylint.

gamma0577
  • 11
  • 1