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

Cannot support windows due to the use of readline module #6

Closed
efJerryYang opened this issue Mar 26, 2023 · 10 comments
Closed

Cannot support windows due to the use of readline module #6

efJerryYang opened this issue Mar 26, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@efJerryYang
Copy link
Owner

Error message:

ModuleNotFoundError: No module named 'readline'   

When I try installing it directly with pip install readline, another error occurs:

error: this module is not meant to work on Windows  

So, it is clear that Python on Windows just does not support the library readline, we may need to use other alternatives for this functionality.

@efJerryYang efJerryYang added the bug Something isn't working label Mar 26, 2023
@PraxTube
Copy link
Collaborator

I tried to replace readline with sys.stdin.readline but that does not work, because it does not support the line buffer mechanic (so it reads from a blank line instead from the ....).

Possible alternatives are:

  • prompt_toolkit
  • curses
  • click

I haven't tried any of them, but I am sure that all of them would require at least some level of rework.

@PraxTube
Copy link
Collaborator

PraxTube commented Mar 26, 2023

Though I gotta ask, do you use the multiline input method often? I haven't found myself using it a single time (at least now that the !editor is there). If I know I need to write a longer message or paste something I will use an editor, and if the message is small enough I can use the in-place variant (often without exceeding one line).

Perhaps the multiline does not need to be supported? Well this is only my opinion anyways. Of course, there is not a lot of harm in supporting it.

@efJerryYang
Copy link
Owner Author

Yes, it makes sense to remove the previous implementation of supporting reading multiple lines if we already have the !editor command. However, as some users (like me 😢 ) have already got very familiar with this usage, it would be much better to deprecate this functionality gradually later rather than do it immediately.

@efJerryYang
Copy link
Owner Author

I find an alternative for Windows, pyreadline3. It works but there is still a display problem with that library. I am trying to figure out the solution and will close this issue after solving it.

@PraxTube
Copy link
Collaborator

However, as some users (like me cry ) have already got very familiar with this usage, it would be much better to deprecate this functionality gradually later rather than do it immediately.

Yes that is true haha.

I find an alternative for Windows, pyreadline3.

Ah nice, I only saw pyreadline which stopped being supported 8 years ago. But pyreadline3 seems to be actively maintained.

@PraxTube
Copy link
Collaborator

PraxTube commented Mar 26, 2023

Though I am a little confused, it seems like we are still using readline in io.py in version 0.1.6. I am using Linux so I can't test the windows version (I also don't have a VM set up atm), but to me this should still generate the same module error.

Or is pyreadline3 somehow able to correct the built-in readline? That would seem pretty magic.

@efJerryYang
Copy link
Owner Author

Do you mean the import readline in the io.py? That's correct, once package pyreadline3 is installed, it would provide support for module readline. I test it on a vbox virtual machine Win10 Microsoft Windows [Version 10.0.19045.2728].

You can see the updated dependency in pyproject.toml and requirements.txt.

@PraxTube
Copy link
Collaborator

Yes that's exactly what I mean. I thought you would need to do something like from pyreadline3 import readline but this is even better.

@efJerryYang
Copy link
Owner Author

Yes, I understand your concern. You can see below:

Screenshot_2023-03-26_133218

@PraxTube
Copy link
Collaborator

Looking great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants