Closed SR-Lut3t1um closed 1 year ago
I installed in Windows cmd via pip, but got the following errors. I think the key problem is No module named 'fcntl'
, Could we replace it with a multi platform OS support library.
D:\Downloads>pip install asciinema
Collecting asciinema
Downloading https://files.pythonhosted.org/packages/a7/71/771c859795e02c71c187546f34f7535487b97425bc1dad1e5f6ad2651357/asciinema-2.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\LIUD~1.H\AppData\Local\Temp\pip-install-yb29pspy\asciinema\setup.py", line 1, in <module>
import asciinema
File "C:\Users\LIUD~1.H\AppData\Local\Temp\pip-install-yb29pspy\asciinema\asciinema\__init__.py", line 15, in <module>
import asciinema.pty as pty
File "C:\Users\LIUD~1.H\AppData\Local\Temp\pip-install-yb29pspy\asciinema\asciinema\pty.py", line 3, in <module> import fcntl
ModuleNotFoundError: No module named 'fcntl'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\LIUD~1.H\AppData\Local\Temp\pip-install-yb29pspy\asciinema\
D:\Downloads>
reference:
I think currently fcntl is one (the only?) roadblock for getting asciinema to run on your mentioned OS.
Searching for fcntl I found two places in the source code where it is used:
https://github.com/asciinema/asciinema/blob/c94e898ec14c35db294974d4c3370fb154eba298/asciinema/pty.py#L36-L43 and https://github.com/asciinema/asciinema/blob/c94e898ec14c35db294974d4c3370fb154eba298/asciinema/pty.py#L150-L153
At line 36 it is just used to get the terminal window size, if it's not possible it uses the 24x80 dimension. This buffer size is set in line 43. I think this operations should be supported by the alternate PTY and could easily replaced.
The more serious part lies in line 150. There the piping gets set to NonBlock mode. But according to this post on stackoverflow there is a workaround: https://stackoverflow.com/q/34504970.
Maybe somebody is willing to try?
I would love windows support!
FWIW, as mentioned in https://github.com/asciinema/discussions/issues/48 there is a native C# port for Windows that records in the asciicast format and supports uploading directly to asciinema.org
@sickill would you mind adding this info to the readme?
(or you can also use terminalizer which is cross-platform and directly outputs GIFs)
there is a native C# port for Windows that records in the asciicast format and supports uploading directly to asciinema.org
Now on rust: https://github.com/Watfaq/PowerSession-rs
Now before you just close this issue, I do undertand why you did not want to support windows terminals. However the new OFFICAL Terminal from windows is goint to have a proper PTY support. So implementing this in windows should be possible.