github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/sqlite-utils/issues/433#issuecomment-1139484453 | https://api.github.com/repos/simonw/sqlite-utils/issues/433 | 1139484453 | IC_kwDOCGYnMM5D6ycl | 4068 | 2022-05-27T10:20:08Z | 2022-05-27T10:20:08Z | NONE | I can confirm. This only happens with sqlite-utils. I am using gnome-terminal with bash. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1239034903 | |
https://github.com/simonw/sqlite-utils/issues/433#issuecomment-1416486796 | https://api.github.com/repos/simonw/sqlite-utils/issues/433 | 1416486796 | IC_kwDOCGYnMM5Ubd-M | 16236421 | 2023-02-03T22:32:10Z | 2023-02-03T22:32:10Z | NONE | Came here to say that I also have this issue. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1239034903 | |
https://github.com/simonw/sqlite-utils/issues/433#issuecomment-1578840450 | https://api.github.com/repos/simonw/sqlite-utils/issues/433 | 1578840450 | IC_kwDOCGYnMM5eGzGC | 392720 | 2023-06-06T14:09:04Z | 2023-06-06T14:09:04Z | NONE | I also ran into this recently. See below for a patch for one possible solution (tested via "it works on my machine", but I don't expect that this behavior would vary a whole lot across terminal emulators and shells). Another possible solution might be to subclass click's `ProgressBar` to keep the logic within the original context manager. Happy to send a PR or for this patch to serve as the basis for a fix that someone else authors. ```patch diff --git a/sqlite_utils/utils.py b/sqlite_utils/utils.py index 06c1a4c..530a3a3 100644 --- a/sqlite_utils/utils.py +++ b/sqlite_utils/utils.py @@ -147,14 +147,23 @@ def decode_base64_values(doc): class UpdateWrapper: - def __init__(self, wrapped, update): + def __init__(self, wrapped, update, render_finish): self._wrapped = wrapped self._update = update + self._render_finish = render_finish def __iter__(self): - for line in self._wrapped: - self._update(len(line)) - yield line + return self + + def __next__(self): + try: + line = next(self._wrapped) + except StopIteration as e: + self._render_finish() + raise + + self._update(len(line)) + return line def read(self, size=-1): data = self._wrapped.read(size) @@ -178,7 +187,7 @@ def file_progress(file, silent=False, **kwargs): else: file_length = os.path.getsize(file.name) with click.progressbar(length=file_length, **kwargs) as bar: - yield UpdateWrapper(file, bar.update) + yield UpdateWrapper(file, bar.update, bar.render_finish) class Format(enum.Enum): ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1239034903 | |
https://github.com/simonw/sqlite-utils/issues/433#issuecomment-1640826795 | https://api.github.com/repos/simonw/sqlite-utils/issues/433 | 1640826795 | IC_kwDOCGYnMM5hzQer | 76528036 | 2023-07-18T19:08:50Z | 2023-07-18T19:08:50Z | NONE | Came here to report this, but instead I'll confirm the issue across two terminal emulators (Gnome Terminal and Alacritty) on Pop_OS! 22.04 (currently based on Ubuntu/Gnome). Also messes up the formatting of the terminal. Can also confirm that reset fixes it until the next sqlite-utils command. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1239034903 |