TransWikia.com

Getting an error for a module that I definitely imported

Stack Overflow Asked by MdCAL12 on December 31, 2020

import pyinputplus as pyip

while True:
    prompt='Want to know how to keep an idiot busy for hours?n'
    response=pyip.inputYesNo(prompt)
    if response=='no':
        break
    print('Thank you. Have a nice day.')

When I run my above code , I get this error:

Traceback (most recent call last):
  File "c:usersXXXXXXmu_codeidiot.py", line 1, in <module>
    import pyinputplus as pyip
  File "c:usersXXXXXXmu_codepyinputplus__init__.py", line 15, in <module>
    import pysimplevalidate as pysv # type: ignore
ModuleNotFoundError: No module named 'pysimplevalidate'

I cannot figure it out. The module is definitely installed. I’ve even moved it from the folder it was originally installed in to the mu folder where the py file is saved. Any help would be appreciated.

One Answer

The ModuleError says that you do not have pysimplevalidate installed.

Using the same python executable as you are using to run your script (idiot.py), run

python -m pip install pysimplevalidate

or, even more bullet-proof:

<path_to_python.exe> -m pip install pysimplevalidate

If you are not sure what python executable the script is using, you can check it with
# put this on top of your script
import sys
print(sys.executable) # will print C:pathtopython.exe

Correct answer by np8 on December 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP