pavdmyt / yaspin

A lightweight terminal spinner for Python with safe pipes and redirects 🎁
https://pypi.org/project/yaspin/
MIT License
787 stars 35 forks source link

Strange spinner behavior in windows terminal #24

Open mzylowski opened 5 years ago

mzylowski commented 5 years ago

Hello!

I have a simple multi-platform app (it's designed for windows and linux environments). Everything works fine for bash terminal, but there is a problem when I start my app on windows. Few firsts lines is printed with strange symbols but, after that everything is fine and my spinner appears: app.exe > output.txt From notepad.exe:

= message...
| message...
] message...
- message...
= message...
| message...
] message...

From notepad++: image

Copied from terminal:

[?25hmessage...

Is there any way to fix this behavior? Can I init yaspin class with some specific values to make it work or smth?

(Please note for debugging purposes I used custom very simple spinner: =|]-)

pavdmyt commented 5 years ago

Hello @mzylowski

Thanks for reporting this!

Yaspin is not targeted for Windows and was never tested under the windows OS. I'd suggest to use halo spinner. It should support both Unix-like and Windows environment.

thouseweart commented 3 years ago

Could you perhaps add a note to the README about the target platforms? I also assumed that this library would work in Windows cmd, and found this Issue after the ANSI escape codes were getting printed to the screen.

Anyone else in my boat who would like to get this working in Windows, try here and here for potential workarounds.

pavdmyt commented 3 years ago

@thouseweart I believe it is possible to add support for Windows-compatible escape codes. Let me investigate this. I'll reopen the issue.

d-chris commented 2 days ago

@mzylowski if you want to use halo on windows you are also limited to "line" spinner

@pavdmyt issue is the codepage cp850 of the terminal, which on windows dated back to ms-dos times.

i tried to contribute to py-spinners / halo and support all spinner with cp850 encoding. PR