-
Notifications
You must be signed in to change notification settings - Fork 13
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
Erroneous character when reading in a loop #8
Comments
Sure - I was able to duplicate the issue with this code:
Run it and make your first selection then try to make a 2nd selection. You'll see it rapidly loop through the dict and crash with an index out of range error. If I add the flush_input() function referenced in my first post to fire immediately before keypress = readchar.readkey(), the menu behaves as expected. |
I can't reproduce the described behaviour.. |
I also cannot reproduce the issue. What version of python and cutie are you using? You mentioned an |
Update: I completely removed cutie using PIP, and reinstalled it using Thanks for helping me with this! I'm using Anaconda with Python 3.7. I'm using the latest cutie available from PyPI ( I recorded an example of the behavior and posted it below. I included the onscreen keyboard so you can see my inputs when the issue arises. The contents of getkey_error.py are the same as the GIST posted before:
|
I still cannot reproduce the issue. HOWEVER, I think it should be fixed in a new branch. Could you manually download the version from there and try if the issue still occurs? Depending on your setup you might have to: # Uninstall cutie
pip3 uninstall cutie
# Link the branch version
# (In the downloaded directory)
pip3 install -e . And then try to reproduce. Of course you can afterwards revert back to the release version with pip3 uninstall cutie
pip3 install cutie Thank you for your help! |
Ok, so I have a bit more information. I tried the new branch and it's improved. The extra key in the buffer is still there, but it doesn't immediately cause cutie to continue to the next menu, so that's an improvement. Since you can't reproduce this, I tried rebooting into safe mode and testing (to eliminate any other programs that may be interacting) and still had the same issue. I then installed cutie on another computer with Anaconda3 and tried the test - WORKS FINE! But that just made my issue more confusing. I then installed a completely separate instance of python (WinPython 3.7 zero), ran the test in there and it also WORKS FINE! Now I have no idea what would be causing it in my primary python installation. Whatever the problem in my installation is, flushing the buffer fixes it... tldr: Something isn't working right in my python installation but your fix improved the experience and makes it usable. Cutie works fine for me in a clean (new) python installation. I have to fix my python. Sorry for wasting your time and I appreciate the help! |
Thank you for the huge amount of effort you are putting into this! You are saying, that it "improves" the situation. Is there any way you are still noticing it or is it (for all intents and purposes) fixed? The extra key should just get dropped now. If there is any chance people could still be experiencing this I'd rather play it save and try to catch the mysterious character. |
The changes you made have caused the extra key to be ignored, but you still have to "get past" it. It's a little clunky to explain, so here is a recording of it in action - notice how I have to hit the arrow twice on the 2nd and 3rd menu prompt. It doesn't affect the selection like it used to, but it's still there. The other thing to note is that Please let me know if you need more info! |
should be fixed in more recent readchar versions |
I'm testing out running the select menu on an unknown depth configuration dictionary like so:
After the first loop, it appears as though there is an erroneous keypress (in my case a letter P) detected and waiting in the buffer. When I use the arrows to make the 2nd selection, two key presses are detected/passed and it breaks out of that selection and continues on to the 3rd. This behaviour repeats until I hit the end of the dict. I added the following code to your init.py from Rosetta Code:
And call that function immediately before "keypress = readchar.readkey()" and it solves the issue. I've tried to track down the source of the erroneous keypress, but haven't had any luck.
The text was updated successfully, but these errors were encountered: