tartley / colorama

Simple cross-platform colored terminal text in Python
BSD 3-Clause "New" or "Revised" License
3.52k stars 250 forks source link

Issue on Windows 10 CMD and Poweshell #309

Open GoingMyWay opened 3 years ago

GoingMyWay commented 3 years ago
  File "D:\x\run.py", line 164, in run_sequential
    bpar = tqdm.tqdm(total=args.t_max)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\std.py", line 1086, in __init__
    self.refresh(lock_args=self.lock_args)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\std.py", line 1380, in refresh
    self.display()
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\std.py", line 1514, in display
    self.sp(self.__repr__() if msg is None else msg)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\std.py", line 335, in print_status
    fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0)))
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\std.py", line 328, in fp_write
    fp.write(_unicode(s))
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\tqdm\utils.py", line 223, in inner
    return func(*args, **kwargs)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
    self.write_plain_text(text, cursor, len(text))
  File "C:\Users\x\anaconda3\envs\py37\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
    self.wrapped.write(text[start:end])
OSError: [WinError 1] Incorrect function

Does anyone know what is wrong?

mara004 commented 3 years ago

Indeed looks like a colorama issue, perhaps a wrong call of the windows colouring API.

GoingMyWay commented 3 years ago

Indeed looks like a colorama issue, perhaps a wrong call of the windows colouring API.

Thanks. Do you know how to address this issue?

mara004 commented 3 years ago

Unfortunately not. I don't know how colorama works internally. However, it seems that it is not your code that triggers the issue, but the tqdm library, so you could try contacting the maintainers of tqdm. Maybe they know (and can fix) the cause.

GoingMyWay commented 3 years ago

Unfortunately not. I don't know how colorama works internally. However, it seems that it is not your code that triggers the issue, but the tqdm library, so you could try contacting the maintainers of tqdm. Maybe they know (and can fix) the cause.

Thank you.

tartley commented 1 year ago

Recent merges may have fixed this issue.