Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using prompt_for_confirmation fails with ModuleNotFoundError on Windows #19

Closed
GhostofGoes opened this issue Nov 24, 2017 · 2 comments
Closed

Comments

@GhostofGoes
Copy link
Contributor

GhostofGoes commented Nov 24, 2017

Using the humanfriendly.prompts.prompt_for_confirmation() function on Windows fails with a ModuleNotFoundError for 'readline'.

Python: 3.6.0 64-bit
Humanfriendly: 4.4.1 (Installed from PyPI using pip)

cmd>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import humanfriendly.prompts
>>> humanfriendly.prompts.prompt_for_confirmation("Testing...", default=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python36\lib\site-packages\humanfriendly\prompts.py", line 86, in prompt_for_confirmation
    reply = prompt_for_input(prompt_text, '', padding=padding, strip=True)
  File "C:\Program Files\Python36\lib\site-packages\humanfriendly\prompts.py", line 245, in prompt_for_input
    prepare_friendly_prompts()
  File "C:\Program Files\Python36\lib\site-packages\humanfriendly\prompts.py", line 328, in prepare_friendly_prompts
    import readline  # NOQA
ModuleNotFoundError: No module named 'readline'

This is likely due to GNU readline not being available on Windows.

The application I'm using humanfriendly with needs to work on Windows, so it would be nice if there was an option to disable readline usage when the import fails.

@cheretbe
Copy link

cheretbe commented Dec 1, 2017

Installing pyreadline package seems to fix prompt_for_confirmation() failing on Windows.

@xolox
Copy link
Owner

xolox commented Jan 4, 2018

Thanks @GhostofGoes for the clear bug report, @cheretbe for suggesting a fix and @GhostofGoes for implementing the fix! I've just merged pull request #20 and published release 4.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants