rr- / pq-cli

Progress Quest: the CLI edition
MIT License
134 stars 21 forks source link

getting "addnwstr() returned ERR" when the 'game' starts #23

Open RetroZelda opened 9 months ago

RetroZelda commented 9 months ago

from latest github I get this error after I create, or continue with, a player:

Traceback (most recent call last): File "/home/quester/pq-venv/bin/pqcli", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/__main__.py", line 88, in main ui.run() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 100, in run self._view.keypress(key) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/menu_view.py", line 40, in keypress self.main_menu.keypress(key) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/widgets/menu.py", line 66, in keypress self._choices[self._active_choice].callback() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/event_handler.py", line 10, in __call__ callback(*args, **kwargs) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 182, in _switch_to_game_view self._switch_view(view) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 187, in _switch_view self._view.start() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/__init__.py", line 197, in start self._plot_win = PlotWindow( ^^^^^^^^^^^ File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 25, in __init__ self.sync() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 46, in sync self._sync_position() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 69, in _sync_position self._render_progress_bar() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/progress_bar_window.py", line 68, in _render_progress_bar self._progress_bar_win.addnstr( _curses.error: addnwstr() returned ERR

rr- commented 9 months ago

I can't replicate it

txtsd commented 9 months ago

@RetroZelda Would you be able to do poetry shell to enter the venv, and then show the output of pip freeze? Also tell us what OS you're running it on, and what terminal and shell you're running it in.

Since you seem to have a user specifically for the purpose of running pq-cli, also tell us any additional information that you might think is relevant in the sense that a regular user of this software would be running it in their default battle-tested desktop environments.

RetroZelda commented 9 months ago

Hello, This user doesnt have sudo permissions and its only role is to run pq-cli and a https://tty-share.com/ instance so I can watch the progress when im bored.

Things were working fine when I was on debian stable, but I recently moved the machine up to testing for an nvidia issue for an unrelated thing on the system. So now the machine is:

this is the results from freeze:

pqcli @ file:///home/quester/pq-cli
urwid==2.1.2
urwid-readline==0.13
xdg==5.1.1

This is a headless machine, so I start pq-cli with a systemd service into a screen. In the service file I define Environment="TERM=xterm-256color"

Because its a headless server I dont have x11 or wayland or any window manager so I typically connect to it via ssh, but the same occurs if I plug a monitor into the machine and login directly.

and in screen I pass it this script used to start pq-cli:

#!/bin/bash

python3 -m venv pq-venv
source pq-venv/bin/activate

git clone https://github.com/rr-/pq-cli.git
pip3 install ./pq-cli

export TERM=xterm-256color
pqcli --load-save 1

deactivate

In the log(and the output if I manually run it) I see the main menu printed once before the crash stack appears, but I can still run with --basic without any issues

genewitch commented 8 months ago

i have this same error/issue on Kali linux (rolling release but up to date), term: qterminal version: 1.4.0-1 $TERM xterm-256colors Python 3.11.6

installed from pip and manually edited the mechanic.py random.seed(now) to str(now)

If there's any way i can help track this i'll try, but i got it running on windows for now anyhow. Thanks!

txtsd commented 8 months ago

Does it run if you pass --basic

EDIT: Derp. Sorry. You already said that. It's the curses library that's not able to handle output then.

RetroZelda commented 7 months ago

looking at it again I tried it on my daily machine that is also debian trixie and I get the same thing on every terminal emulator I tried.

I did find a workaround for my specific desires by throwing this together https://github.com/RetroZelda/pqcli-stream its generally using xterm from ubuntu in a docker container and it streams to twitch using ffmpeg instead of using tty-share.

noUsernamesLef7 commented 4 months ago

I'm also running into this on an Arch based distro. The crash occurs when I hit F10 to continue at the character stat rolls screen. I'm using the latest commit. 803eba416e6f2ec36ea74269abcee3cd91c4c124

Python: 3.12.4

urwid==2.6.10
urwid_readline==0.14
xdg-base-dirs==6.0.1
Traceback (most recent call last):
  File "/usr/bin/pqcli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/pqcli/__main__.py", line 88, in main
    ui.run()
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/__init__.py", line 100, in run
    self._view.keypress(key)
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/create_character_view/choose_character_stats_view.py", line 71, in keypress
    self.on_confirm(self._stats)
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/event_handler.py", line 10, in __call__
    callback(*args, **kwargs)
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/__init__.py", line 152, in <lambda>
    view.on_confirm += lambda stats: self._create_character(
                                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/__init__.py", line 196, in _create_character
    self._switch_to_game_view(player)
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/__init__.py", line 182, in _switch_to_game_view
    self._switch_view(view)
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/__init__.py", line 187, in _switch_view
    self._view.start()
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/game_view/__init__.py", line 197, in start
    self._plot_win = PlotWindow(
                     ^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 25, in __init__
    self.sync()
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 46, in sync
    self._sync_position()
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 69, in _sync_position
    self._render_progress_bar()
  File "/usr/lib/python3.12/site-packages/pqcli/ui/curses/views/game_view/progress_bar_window.py", line 68, in _render_progress_bar
    self._progress_bar_win.addnstr(
_curses.error: addnwstr() returned ERR