toot
toot copied to clipboard
NameError: name 'fcntl' is not defined
When I try to open the TUI, I get this error:
Traceback (most recent call last):
File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\Scripts\toot.exe\__main__.py", line 7, in <module>
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\toot\console.py", line 560, in main
run_command(app, user, command_name, args)
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\toot\console.py", line 542, in run_command
return fn(app, user, parsed_args)
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\toot\commands.py", line 347, in tui
TUI.create(app, user).run()
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\toot\tui\app.py", line 78, in create
loop = urwid.MainLoop(
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\urwid\main_loop.py", line 115, in __init__
screen = raw_display.Screen()
File "C:\Users\mikwee\AppData\Roaming\Python\Python310\site-packages\urwid\raw_display.py", line 92, in __init__
fcntl.fcntl(self._resize_pipe_rd, fcntl.F_SETFL, os.O_NONBLOCK)
NameError: name 'fcntl' is not defined
What's happening?
fcntl is not supported on windows. If you want to run toot tui
you can try using WSL, although it might be overkill if that's the only thing you're using it for. It might also work in cygwin, not sure, don't have a windows box to test.
Is there no file handling library in Python that abstracts between platforms?
fnctl is used by urwid, which is used to build the TUI. I haven't really looked into how it could be made to work on windows.
I think it would require switching from urwid to a library that supports Windows terminals as well, like asciimatics, blessed, prompt_toolkit, or textual.
If that's a direction you're willing to go, I'd be happy to work on it. I'd like to be able to use the TUI on Windows without resorting to WSL.
@wtee It is something I have considered. I tried blessed and prompt_toolkit and wasn't enamored. I liked the look of textual but it's very early in development, and needs a bit more time to mature. I'll probably be making incremental improvements to urwid variant for a little while longer. I'll check out asciimatics too, since I haven't looked at it yet.
version 0.42.0 works like a charm in cygwin on Windows 10. Installing with ' python -m pip install toot==0.42' hung installing urwid, so I just installed urwid separately.
If I knew it was going to be this easy with cygwin, I would have installed it whenI forked it last year, 60 commits ago.