Skip to content

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

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

Closed
ThatXliner opened this issue May 9, 2021 · 13 comments
Closed

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

ThatXliner opened this issue May 9, 2021 · 13 comments
Assignees
Labels
Milestone

Comments

@ThatXliner
Copy link

ThatXliner commented May 9, 2021

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)
@ThatXliner
Copy link
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

@sebastinas
Copy link
Contributor

Are you using cwcwidth version 0.1.3 or newer?

@sebastinas sebastinas added the bug label May 10, 2021
@ThatXliner
Copy link
Author

ThatXliner commented May 10, 2021

Are you using cwcwidth version 0.1.3 or newer?

How do I test that?

EDIT: Also, the issue is still reproducing

@sebastinas
Copy link
Contributor

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

@ThatXliner
Copy link
Author

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

@sebastinas
Copy link
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.

@ThatXliner
Copy link
Author

ThatXliner commented May 12, 2021

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

@sebastinas
Copy link
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?

@ThatXliner
Copy link
Author

ThatXliner commented May 13, 2021

I suppose you are using the default config, right?

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

@sebastinas
Copy link
Contributor

sebastinas commented May 16, 2021

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

@sebastinas
Copy link
Contributor

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

@ThatXliner
Copy link
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)

@sebastinas
Copy link
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.

@sebastinas sebastinas self-assigned this May 16, 2021
@sebastinas sebastinas added this to the release-0.22 milestone May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants