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

Provide resizeterm function #40

Open
cool-RR opened this issue Dec 22, 2022 · 0 comments
Open

Provide resizeterm function #40

cool-RR opened this issue Dec 22, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@cool-RR
Copy link

cool-RR commented Dec 22, 2022

Libraries that use Curses expect the resizeterm function to be available:

Administrator@Turing MSYS /m/home/ramrachum/.nichos/boulder/2022-12-22-21-31-55-165428
$ tabview rollout.csv
Traceback (most recent call last):
  File "C:\Program Files\Python310\Scripts\tabview", line 108, in <module>
    view(data, enc=args.encoding, start_pos=start_pos,
  File "C:\Program Files\Python310\lib\site-packages\tabview\tabview.py", line 1319, in view
    curses.wrapper(main, buf,
  File "C:\Program Files\Python310\lib\curses\__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "C:\Program Files\Python310\lib\site-packages\tabview\tabview.py", line 1250, in main
    Viewer(stdscr, *args, **kwargs).run()
  File "C:\Program Files\Python310\lib\site-packages\tabview\tabview.py", line 109, in __init__
    self.resize()
  File "C:\Program Files\Python310\lib\site-packages\tabview\tabview.py", line 756, in resize
    curses.resizeterm(self.max_y, self.max_x)
AttributeError: module 'curses' has no attribute 'resizeterm'. Did you mean: 'resize_term'?

I believe that in order to use Tabview with Curses on Windows, the resizeterm function will need to be implemented. Based on https://docs.python.org/3/library/curses.html#curses.resize_term it might be slightly different than resize_term.

@stephanosio stephanosio added the enhancement New feature or request label May 5, 2024
cas-- added a commit to deluge-torrent/deluge that referenced this issue Sep 8, 2024
Testing with window-curses results in hangs on initial loading with background error:

    File "C:\Users\Docker\Deluge\.venv\lib\site-packages\twisted\internet\selectreactor.py", line 39, in win32select
        r, w, e = select.select(r, w, w, timeout)
    builtins.OSError: [WinError 10038] An operation was attempted on something that is not a socket

This is due to passing a Console class to addReader but this fails since
select on Windows cannot handle non-socket file object unlike Unix which accepts
sockets and file objects.

There is likely a further issue where windows-curses has not implemented
resizeterm so would need to use resize_term instead.

Refs: https://docs.python.org/3/library/select.html#select.select
Refs: https://stackoverflow.com/questions/11731175/python-twisted-addreader-works-in-linux-but-not-windows
Refs: zephyrproject-rtos/windows-curses#40
Refs: https://docs.python.org/3/library/curses.html#curses.resize_term

Closes: #457
Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
doadin pushed a commit to doadin/deluge that referenced this issue Sep 21, 2024
Testing with window-curses results in hangs on initial loading with background error:

    File "C:\Users\Docker\Deluge\.venv\lib\site-packages\twisted\internet\selectreactor.py", line 39, in win32select
        r, w, e = select.select(r, w, w, timeout)
    builtins.OSError: [WinError 10038] An operation was attempted on something that is not a socket

This is due to passing a Console class to addReader but this fails since
select on Windows cannot handle non-socket file object unlike Unix which accepts
sockets and file objects.

There is likely a further issue where windows-curses has not implemented
resizeterm so would need to use resize_term instead.

Refs: https://docs.python.org/3/library/select.html#select.select
Refs: https://stackoverflow.com/questions/11731175/python-twisted-addreader-works-in-linux-but-not-windows
Refs: zephyrproject-rtos/windows-curses#40
Refs: https://docs.python.org/3/library/curses.html#curses.resize_term

Closes: deluge-torrent#457
Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
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

2 participants