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

Stack trace: RuntimeError: generator raised StopIteration #12

Open
danielhoherd opened this issue Apr 27, 2022 · 2 comments
Open

Stack trace: RuntimeError: generator raised StopIteration #12

danielhoherd opened this issue Apr 27, 2022 · 2 comments

Comments

@danielhoherd
Copy link

$ pipx install dunk
  installed package dunk 0.4.0a0, installed using Python 3.10.4
  These apps are now globally available
    - dunk
done! ✨ 🌟 ✨
$ git clone [email protected]:darrenburns/dunk.git
Cloning into 'dunk'...
remote: Enumerating objects: 129, done.
remote: Counting objects: 100% (129/129), done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 129 (delta 52), reused 98 (delta 34), pack-reused 0
Receiving objects: 100% (129/129), 46.59 KiB | 11.65 MiB/s, done.
Resolving deltas: 100% (52/52), done.
$ cd dunk
$ git show 53acb8e | dunk

...lots of normal dunk content...

Traceback (most recent call last):
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/syntax.py", line 458, in tokens_to_spans
    _token_type, token = next(tokens)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/danielh/.local/bin/dunk", line 8, in <module>
    sys.exit(main())
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/dunk/dunk.py", line 352, in main
    source_syntax_lines: List[List[Segment]] = console.render_lines(
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/console.py", line 1334, in render_lines
    lines = list(
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/segment.py", line 291, in split_and_crop_lines
    for segment in segments:
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/console.py", line 1299, in render
    for render_output in iter_render:
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/syntax.py", line 554, in __rich_console__
    text = self.highlight(code, self.line_range)
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/syntax.py", line 470, in highlight
    text.append_tokens(tokens_to_spans())
  File "/Users/danielh/.local/pipx/venvs/dunk/lib/python3.9/site-packages/rich/text.py", line 969, in append_tokens
    for content, style in tokens:
RuntimeError: generator raised StopIteration

Tested on macOS 12.3.1 with python 3.9.12 and ubuntu 22.04 with python 3.10.4, both installed via pipx.

@reduxionist
Copy link

FWIW, I was unable to reproduce on Ubuntu 20.04 and Python 3.8.2, installed with pipx.

@danielhoherd
Copy link
Author

This fails: $ docker run --rm -ti ubuntu:22.04 /bin/bash -exc 'apt update ; apt install -y git python3 python3-pip python3-venv ; pip install pipx ; pipx install dunk==0.4.0a0 ; git clone https://github.com/darrenburns/dunk.git ; cd dunk ; git show 53acb8e | "$HOME/.local/bin/dunk"'

It also fails when you use ubuntu:20.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants