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

catch all curses addwstr() errors and print a helpful error message #64

Open
ericaltendorf opened this issue Apr 1, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@ericaltendorf
Copy link
Owner

addwstr() is used to display text in curses and throws an error if there's not enough space for the text.

aside from trying to not add too much text, we could at least wrap the writes in a try and catch the error and print out something like "try increasing your terminal size".

current workaround: try increasing your terminal size...

@altendky
Copy link
Collaborator

altendky commented Apr 1, 2021

I haven't worked with curses, so maybe this doesn't apply. With Qt you have lots of callbacks for handling events. For every one of them I wanted an error handler that would pop up a dialog with (otherwise) uncaught exceptions. Rather than strewing that handling into every callback I used sys.excepthook to provide a universal handler. Anyways, it may not work here, it may cause other troubles, so... just mentioning. (presumably I won't do this as I shift towards structured concurrency what with moving towards QTrio)

@egtalbot
Copy link

egtalbot commented Apr 20, 2021

I'll just add more data here. I ran into this when running in Terminal Window in Ubuntu and switching off the plotting machine in my HDMI switcher, plotman crashes when a plot ends (sorry for the lack of line breaks, this is how it pasted):

Traceback (most recent call last): File "/home/satan/programs/chia-blockchain/venv/bin/plotman", line 8, in <module> sys.exit(main()) File "/home/satan/programs/chia-blockchain/venv/lib/python3.8/site-packages/plotman/plotman.py", line 132, in main interactive.run_interactive() File "/home/satan/programs/chia-blockchain/venv/lib/python3.8/site-packages/plotman/interactive.py", line 360, in run_interactive curses.wrapper(curses_main) File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper return func(stdscr, *args, **kwds) File "/home/satan/programs/chia-blockchain/venv/lib/python3.8/site-packages/plotman/interactive.py", line 278, in curses_main jobs_win.addstr(0, 0, reporting.status_report(jobs, n_cols, jobs_h, _curses.error: addwstr() returned ERR

@g4m3r0
Copy link

g4m3r0 commented Apr 22, 2021

I do get the same error running plotman interactive if the size of the console window is to small:

(venv) ubuntu@ubuntu-PowerEdge-T310:~/git/chia-blockchain$ plotman interactive
Traceback (most recent call last):
File "/home/ubuntu/git/chia-blockchain/venv/bin/plotman", line 8, in
sys.exit(main())
File "/home/ubuntu/git/chia-blockchain/venv/lib/python3.8/site-packages/plotman/plotman.py", line 171, in main
interactive.run_interactive()
File "/home/ubuntu/git/chia-blockchain/venv/lib/python3.8/site-packages/plotman/interactive.py", line 353, in run_interactive
curses.wrapper(curses_main)
File "/usr/lib/python3.8/curses/init.py", line 105, in wrapper
return func(stdscr, *args, **kwds)
File "/home/ubuntu/git/chia-blockchain/venv/lib/python3.8/site-packages/plotman/interactive.py", line 271, in curses_main
jobs_win.addstr(0, 0, reporting.status_report(jobs, n_cols, jobs_h,
_curses.error: addwstr() returned ERR

@Klaudioz
Copy link

Klaudioz commented May 2, 2021

I just maximized the terminal, run it again and it worked.

@BasilHorowt BasilHorowt added the enhancement New feature or request label May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants