Python Forum

Full Version: failure to find modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am quite new to Python and this is my first time using modules. Every time I try to import a module I get the error: ModuleNotFoundError: No module named '_curses'.
When using the commandprompt with py -m pip install curses, I get the message that it is allready installed and I get the path to the installed module. I still got the error message. Then I added the path to PYTHONPATH, still the same error. Then I added it to sys.path, but still the same error. Can anyone please help me with some information on how to correctly make use of the module?

Greetings,

Justus
Why is there an underscore before curses? Your code should be import curses. How are you changing sys.path if you can't import sys? Please show the exact code you are using to import, in python tags (see the BBCode link below) and the full text of the error message you are getting.
(Dec-14-2018, 03:04 PM)ichabod801 Wrote: [ -> ]Why is there an underscore before curses?
The first line of the curses module imports _curses: https://github.com/python/cpython/blob/m...t__.py#L13
Quote:
"""curses
The main package for curses support for Python.  Normally used by importing
the package, and perhaps a particular module inside it.
   import curses
   from curses import textpad
   curses.initscr()
   ...
"""

from _curses import *

curses is a builtin module, there's nothing to install. _curses, which actually does most of the work, is a c extension module, that's built into python. If you're on windows, then you'll need to install the third party windows-curses, as the builtin curses package only works on unix systems (...since curses is a unix program that doesn't work on windows lol).