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

austin-tui raising a ValueError on startup #31

Open
gibsondan opened this issue Oct 9, 2024 · 3 comments
Open

austin-tui raising a ValueError on startup #31

gibsondan opened this issue Oct 9, 2024 · 3 comments

Comments

@gibsondan
Copy link

Description

austin-tui fails on startup with a curses exception. I expect fixing this is as simple as catching ValueError in addition to curses.error in the exception handler in question:

    def init(self) -> None:
        """Initialise the curses color pairs."""
        try:
            for cid, pair in self._color_pairs.items():
                curses.init_pair(cid, *pair)
        except curses.error:
            curses.use_default_colors()

Steps to Reproduce

Run austin-tui -p 1 on any python process.

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

  File "/usr/local/bin/austin-tui", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/austin_tui/__main__.py", line 175, in main
    tui.run()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/__main__.py", line 146, in run
    austin.result()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/__main__.py", line 126, in start
    await super().start(args)
  File "/usr/local/lib/python3.11/site-packages/austin/aio.py", line 126, in start
    self._ready_callback(
  File "/usr/local/lib/python3.11/site-packages/austin_tui/__main__.py", line 95, in on_ready
    self._controller.start()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/controller.py", line 141, in start
    self.view.open()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/view/austin.py", line 164, in open
    super().open()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/view/__init__.py", line 214, in open
    self.palette.init()
  File "/usr/local/lib/python3.11/site-packages/austin_tui/view/palette.py", line 66, in init
    curses.init_pair(cid, *pair)
ValueError: Color number is greater than COLORS-1 (7).

Reproduces how often: [What percentage of the time does it reproduce?]

100%

Versions

Python 3.11.10
austin 3.6.0

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to
reproduce the issue.

@P403n1x87 P403n1x87 transferred this issue from P403n1x87/austin Oct 10, 2024
@P403n1x87
Copy link
Owner

@gibsondan thanks for reporting this. Does export TERM=xterm-256color help in your case?

@gibsondan
Copy link
Author

That does fix it, yes! Manually editing the Python file above to catch all Exceptions also fixed it.

@P403n1x87
Copy link
Owner

Yep I think we should add the exception handling, perhaps with a message instructing the user to ensure support for a 256-color palette

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