jarun / buku

:bookmark: Personal mini-web in text
GNU General Public License v3.0
6.52k stars 294 forks source link

Readline internal error #704

Closed Remiol closed 11 months ago

Remiol commented 11 months ago

Bug reports

Python 3.12 buku 4.7.1

I very often get this error when I want to open a web page (see the first line below).

☺buku (? for help) 3 Readline internal error Traceback (most recent call last): File "\Python312\Lib\site-packages\pyreadline3\console\console.py", line 804, in hook_wrapper_23 res = ensure_str(readline_hook(prompt)) ^^^^^^^^^^^^^^^^^^^^^ File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 587, in readline self.readline_setup(prompt) File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 583, in readline_setup self._print_prompt() File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 487, in _print_prompt n = c.write_scrolling(self.prompt, self.prompt_color) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\Python312\Lib\site-packages\pyreadline3\console\console.py", line 332, in write_scrolling w, h = self.size() ^^^^ TypeError: cannot unpack non-iterable NoneType object Readline internal error Traceback (most recent call last): File "\Python312\Lib\site-packages\pyreadline3\console\console.py", line 804, in hook_wrapper_23 res = ensure_str(readline_hook(prompt)) ^^^^^^^^^^^^^^^^^^^^^ File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 587, in readline self.readline_setup(prompt) File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 583, in readline_setup self._print_prompt() File "\Python312\Lib\site-packages\pyreadline3\rlmain.py", line 487, in _print_prompt n = c.write_scrolling(self.prompt, self.prompt_color) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\Python312\Lib\site-packages\pyreadline3\console\console.py", line 332, in write_scrolling w, h = self.size() ^^^^ TypeError: cannot unpack non-iterable NoneType object

LeXofLeviafan commented 11 months ago

Does this happen on v4.8/nightly as well? If not then it's been fixed already.

(You can download the repo as an archive and run pipx install . inside the unpacked folder to install a specific version locally for the user; running pipx uninstall buku would revert the installation.)

Remiol commented 11 months ago

If you don't mind, after previous experiences I have decided not to install any more extensions if they are not from pypi. I will wait until the official 4.8 version.

Remiol commented 11 months ago

I had enough of all these errors and installed buku 4.8 anyway. Still the same error.

LeXofLeviafan commented 11 months ago

Haven't managed to reproduce this, no matter which version I tried (4.7.1, 4.8, nightly).

Remiol commented 11 months ago

Hi,

Haven't managed to reproduce this, no matter which version I tried (4.7.1, 4.8, nightly).

* You're using Windows, correct? It shouldn't be possible to install `pyreadline3` on any other OS.

correct

* Is the package installed via pipx, in a venv, or globally?

I used pipx

* The paths in the log are odd. Did you modify them (e.g. by omitting user directory path)?

Yes, I installed python in the root in "c"

* Have you made sure that in the 2nd test you're actually running version 4.8? (Run `buku -v` to check)

buku -v >> 4.8

* Which version of `pyreadline3` are you using? The latest one (3.4.1)? (`pip show pyreadline3` for global install, `pipx runpip buku show pyreadline3` for pipx install)

Name: pyreadline3 Version: 3.4.1

* Which terminal emulator are you running buku in? Is it the standard Windows CMD shell, or something else? (I've checked in CMD and in Git Bash which is included in Git-for-Windows installation.)

yes, windows command prompt.

It does give the error after a search and 'a' (open all results in browser) buku (? for help) a or after a search and multiple results to open in browser (p.e. 2 and 4) buku (? for help) 2 4 or after a search and a one result to open in browser (p.e. 2) and after this one another one (p.e. 4) buku (? for help) 2 >> no error buku (? for help) 4 >> error

LeXofLeviafan commented 11 months ago

…Alright, I've figured it out.

The important missing detail is that this only happens on Windows 11, which uses a new-and-fancy terminal wrapper (and reacts poorly to I/O stream manipulation… I'd call it a bug but I would not be surprised if MS declared it a ‘feature’ :sweat_smile:).

Remiol commented 11 months ago

Thank you for the adjustment. Where can I download the new file? I still see the 4.8 version in downloads and the buku-master.zip file still gives the same error.

LeXofLeviafan commented 11 months ago

Er… Well, that shouldn't be happening; I just double-checked, the current nightly doesn't cause that error on Windows 11 (at least not in circumstances it did before). Have you made sure you did every step correctly? :sweat_smile:

I know this might be annoying but I don't really have any other explanation as to why the issue doesn't reproduce with current nightly on my Windows 11 VM (unlike when using the 4.8 archive or previous nightly) but apparently does on your machine.

P.S. To reproduce, I used a dummy database file (C:\Users\%USERNAME%\AppData\Roaming\buku\bookmarks.db) containing 4 bookmarks, 2 of which have a site tag. Then, I ran the buku command, followed by t site (which printed out those two bookmarks), and used one of the suggested inputs (a, 1 2, or 1 followed by 2). Each of these causes an error when using buku installed from 4.8 archive or the old nightly, but works just fine with the current one.

Remiol commented 11 months ago

Sorry, you're right. I updated Buku (not uninstalling the previous version).

Now I uninstalled it first. No error any more. :)

(By the way 4.7.1 is still the latest version at PyPi)

LeXofLeviafan commented 11 months ago

I updated Buku (not uninstalling the previous version)

I've made sure to check what happens if you try installing a new version without uninstalling the old version from pipx… It basically says "I didn't do anything cuz the package is already installed… And I could overwrite it but only if you pass a specific parameter" :sweat_smile:

By the way 4.7.1 is still the latest version at PyPi

The current 4.8 can't be added to PyPI because it has an external (Github) dependency. And the guy who was maintaining it basically disappeared since February.

I suspect we'll have to deal with this without him after all, but that discussion belongs in the #685 thread.