tconbeer / harlequin

The SQL IDE for Your Terminal.
https://harlequin.sh
MIT License
3.8k stars 87 forks source link

V1.25.0 Crashes on Windows 11 with Python 3.11.6 #672

Closed hcc-donder closed 3 weeks ago

hcc-donder commented 1 month ago

Before Proceeding, please acknowledge:

Describe the bug

Installed and tried to run the command harlequin at the command line. Harlequin crashes with a long Traceback report.

To Reproduce

Installed and tried to run the command harlequin at the command line.

Expected behavior

To open harlequin with the default database selected.

Actual behavior

Crashes with the following:

╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\widget.py:3420 in render_lines     │
│                                                                                                                      │
│   3417 │   │   Returns:                                                                                              │
│   3418 │   │   │   A list of list of segments.                                                                       │
│   3419 │   │   """                                                                                                   │
│ ❱ 3420 │   │   strips = self._styles_cache.render_widget(self, crop)                                                 │
│   3421 │   │   return strips                                                                                         │
│   3422 │                                                                                                             │
│   3423 │   def get_style_at(self, x: int, y: int) -> Style:                                                          │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\_styles_cache.py:119 in            │
│ render_widget                                                                                                        │
│                                                                                                                      │
│   116 │   │                                                                                                          │
│   117 │   │   base_background, background = widget._opacity_background_colors                                        │
│   118 │   │   styles = widget.styles                                                                                 │
│ ❱ 119 │   │   strips = self.render(                                                                                  │
│   120 │   │   │   styles,                                                                                            │
│   121 │   │   │   widget.region.size,                                                                                │
│   122 │   │   │   base_background,                                                                                   │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\_styles_cache.py:218 in render     │
│                                                                                                                      │
│   215 │   │   render_line = self.render_line                                                                         │
│   216 │   │   for y in crop.line_range:                                                                              │
│   217 │   │   │   if is_dirty(y) or y not in self._cache:                                                            │
│ ❱ 218 │   │   │   │   strip = render_line(                                                                           │
│   219 │   │   │   │   │   styles,                                                                                    │
│   220 │   │   │   │   │   y,                                                                                         │
│   221 │   │   │   │   │   size,                                                                                      │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\_styles_cache.py:441 in            │
│ render_line                                                                                                          │
│                                                                                                                      │
│   438 │   │   │   # Content with border and padding (C)                                                              │
│   439 │   │   │   content_y = y - gutter.top                                                                         │
│   440 │   │   │   if content_y < content_height:                                                                     │
│ ❱ 441 │   │   │   │   line = render_content_line(y - gutter.top)                                                     │
│   442 │   │   │   │   line = line.adjust_cell_length(content_width)                                                  │
│   443 │   │   │   else:                                                                                              │
│   444 │   │   │   │   line = [make_blank(content_width, inner)]                                                      │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\widgets\_text_area.py:1217 in      │
│ render_line                                                                                                          │
│                                                                                                                      │
│   1214 │   │                                                                                                         │
│   1215 │   │   # Crop the line to show only the visible part (some may be scrolled out of view)                      │
│   1216 │   │   if not self.soft_wrap:                                                                                │
│ ❱ 1217 │   │   │   text_strip = text_strip.crop(                                                                     │
│   1218 │   │   │   │   scroll_x, scroll_x + virtual_width - gutter_width                                             │
│   1219 │   │   │   )                                                                                                 │
│   1220                                                                                                               │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\textual\strip.py:412 in crop               │
│                                                                                                                      │
│   409 │   │   │   │   │   if end_pos < end:                                                                          │
│   410 │   │   │   │   │   │   add_segment(segment)                                                                   │
│   411 │   │   │   │   │   else:                                                                                      │
│ ❱ 412 │   │   │   │   │   │   add_segment(segment.split_cells(end - pos)[0])                                         │
│   413 │   │   │   │   │   │   break                                                                                  │
│   414 │   │   │   │   │   pos = end_pos                                                                              │
│   415 │   │   │   │   │   segment = next(iter_segments, None)                                                        │
│                                                                                                                      │

... Locals removed

│                                                                                                                      │
│ C:\Users\donder\AppData\Local\pipx\pipx\venvs\harlequin\Lib\site-packages\rich\segment.py:171 in split_cells         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError
_GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=CancelledError()>
Traceback (most recent call last):
  File "C:\Python\Python311\Lib\asyncio\queues.py", line 215, in join
    await self._finished.wait()
  File "C:\Python\Python311\Lib\asyncio\locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError
_GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=CancelledError()>
Traceback (most recent call last):
  File "C:\Python\Python311\Lib\asyncio\queues.py", line 215, in join
    await self._finished.wait()
  File "C:\Python\Python311\Lib\asyncio\locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

Contributing Are you interested in contributing a fix?

What is the output of harlequin --version?

harlequin, version 1.25.0

Installed Adapters:
  - duckdb, version 1.25.0
  - sqlite, version 1.25.0
  - odbc, version 0.1.1

What database adapter are you using with Harlequin? (Default is duckdb)

I have installed duckdb, sqlite, and odbc but using the default.

What other options are you using when invoking Harlequin? (If you are using a profile, please add relevant items from your profile here).

I get this error whether I am using a profile or not. I deleted my profile after getting this error and still receive the error.

Can you tell us more about your system?

How did you install Harlequin?

tconbeer commented 1 month ago

This shares the same upstream cause as #659 The latest version of Rich adds an assert, which causes this crash, instead of a hang. I will need to bump the Textual version to 0.85.0 to fix this issue in Harlequin

patricksabry1 commented 4 weeks ago

@hcc-donder I just encountered this issue too, attempting to run Harlequin on WSL (Ubuntu) on Windows 11. I was able to resolve this for now by manually bumping Textual to latest (0.85.1) within my Python virtual env:

pip install textual==0.85.1

@tconbeer thanks for the time save and thanks for this wonderful tool!