Skip to content

AssertionError: (-1, 163, 5, 0, 0) #896

Closed

Description

@ThatXliner

I just installed bpython using pipx and...

bpython version 0.21 on top of Python 3.7.9 /Users/bryanhu/.local/pipx/venvs/bpython/bin/python

Traceback (most recent call last):
  File "/Users/bryanhu/.local/bin/bpython", line 8, in <module>
    sys.exit(main())
  File "/Users/bryanhu/.local/pipx/venvs/bpython/lib/python3.7/site-packages/bpython/curtsies.py", line 201, in main
    exit_value = repl.mainloop(True, paste)
  File "/Users/bryanhu/.local/pipx/venvs/bpython/lib/python3.7/site-packages/bpython/curtsies.py", line 113, in mainloop
    self.process_event_and_paint(None)
  File "/Users/bryanhu/.local/pipx/venvs/bpython/lib/python3.7/site-packages/bpython/curtsies.py", line 95, in process_event_and_paint
    array, cursor_pos = self.paint()
  File "/Users/bryanhu/.local/pipx/venvs/bpython/lib/python3.7/site-packages/bpython/curtsiesfrontend/repl.py", line 1615, in paint
    self.cursor_offset,
AssertionError: (-1, 163, 5, 0, 0)

Activity

  1. ThatXliner commented on May 9, 2021

    @ThatXliner
    Author

    Repro percentage: 100% (even after restarting my terminal)
    (Possible) Repro steps:

    • Install bpython using pipx
    • Run bpython-curses several times
    • Run bpython

    Possibly useful:
    Screen Shot 2021-05-08 at 5 50 26 PM

  2. sebastinas commented on May 10, 2021

    @sebastinas
    Contributor

    Are you using cwcwidth version 0.1.3 or newer?

  3. ThatXliner commented on May 10, 2021

    @ThatXliner
    Author

    Are you using cwcwidth version 0.1.3 or newer?

    How do I test that?

    EDIT: Also, the issue is still reproducing

  4. sebastinas commented on May 10, 2021

    @sebastinas
    Contributor

    pip freeze should tell you. Otherwise: python -c "import cwcwidth; print(cwcwidth.__version__)"

  5. ThatXliner commented on May 10, 2021

    @ThatXliner
    Author

    Screen Shot 2021-05-10 at 9 14 39 AM

  6. sebastinas commented on May 12, 2021

    @sebastinas
    Contributor

    Okay, this looks like a case where cwcwidth fails to determine the length of a string with your locale. So: what's your locale? On the main branch you can also run bpython -l info -L log and check the file log for the version and environment variable output.

  7. ThatXliner commented on May 12, 2021

    @ThatXliner
    Author

    Screen Shot 2021-05-12 at 2 33 40 PM

    $ locale
    LANG="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_ALL=
    

    Screen Shot 2021-05-12 at 2 30 27 PM

  8. sebastinas commented on May 13, 2021

    @sebastinas
    Contributor

    Thanks. \r shouldn't be contained in that string. I'll need to find out if some code path acts differently under iTerm2 that causes \r to be present. I suppose you are using the default config, right?

  9. ThatXliner commented on May 13, 2021

    @ThatXliner
    Author

    I suppose you are using the default config, right?

    No, I did quite some customizations (assuming you're referring to iTerm2)

  10. sebastinas commented on May 16, 2021

    @sebastinas
    Contributor

    I meant your bpython config. Did you change its or Python's ps1 or ps2?

  11. sebastinas commented on May 16, 2021

    @sebastinas
    Contributor

    Okay, I think I got it. Your sys.ps1 i set to \r>>> . I guess we need to strip \r in that case.

  12. ThatXliner commented on May 16, 2021

    @ThatXliner
    Author

    Yes, my sys.ps1 is configured. To be precise, it has ansi escapes in them. I added the /r just in case (pasting was getting wonky but now I figured it's Python's fault. I can change it back if I need to make this work)

  13. sebastinas commented on May 16, 2021

    @sebastinas
    Contributor

    At least the \r is a problem. In any case, I'll fix it to not fail but ignore it in case bpython cannot handle it.

  14. self-assigned this
    on May 16, 2021
  15. added this to the release-0.22 milestone on May 16, 2021
  16. added a commit that references this issue on Feb 25, 2026
    bc7ea75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions