pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.42k stars 370 forks source link

clint issues and project seems abandoned #967

Closed GMaxera closed 1 year ago

GMaxera commented 1 year ago

Recently switched from Python 3.8 to Python 3.10 on my Windows 11 machine and invoke starts to crash due to some clint internal code.

 File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\invoke\runners.py", line 775, in handle_stdout
    self._handle_output(
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\invoke\runners.py", line 747, in _handle_output
    self.write_our_output(stream=output, string=data)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\invoke\runners.py", line 729, in write_our_output
    stream.write(string)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 34, in write
    self.__convertor.write(text)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 115, in write
    self.write_and_convert(text)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 140, in write_and_convert
    self.convert_ansi(*match.groups())
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 154, in convert_ansi
    self.call_win32(command, params)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 181, in call_win32
    func(params, on_stderr=self.on_stderr)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\winterm.py", line 94, in erase_data
    csbi = win32.GetConsoleScreenBufferInfo(handle)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\win32.py", line 63, in GetConsoleScreenBufferInfo
    success = windll.kernel32.GetConsoleScreenBufferInfo(
ctypes.ArgumentError: argument 2: TypeError: expected LP_CONSOLE_SCREEN_BUFFER_INFO instance instead of pointer to CONSOLE_SCREEN_BUFFER_INFO
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\invoke\runners.py", line 747, in _handle_output
    self.write_our_output(stream=output, string=data)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\invoke\runners.py", line 729, in write_our_output
    stream.write(string)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 34, in write
    self.__convertor.write(text)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 115, in write
    self.write_and_convert(text)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 140, in write_and_convert
    self.convert_ansi(*match.groups())
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 154, in convert_ansi
    self.call_win32(command, params)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\ansitowin32.py", line 181, in call_win32
    func(params, on_stderr=self.on_stderr)
  File "C:\Users\gianluca.massera\Developer\virtualenvs\osirium-main-testing-310\lib\site-packages\clint\packages\colorama\winterm.py", line 87, in erase_data
    if mode[0] not in (2,):
IndexError: tuple index out of range

Is there a way to run invoke without clint or by-pass or workaround? Is there any plan on replacing clint with an active project?

GMaxera commented 1 year ago

Sorry, I initially thought that invoke was using clint ... but I was mistaken.

After digging into it, I've found that another package I use imports clint ... and it seems that invoke "detects" and uses the vendor colorama version packaged inside clint ... for a reason I don't know.

Or it could be that clint fiddles with stdout and stderr that makes invoke use the wrong colorama version?

Not sure how to by-pass this issue. Any help appreciated.

GMaxera commented 1 year ago

Not related to invoke project. Sorry to have open that.