halo
halo copied to clipboard
there is logical bug in code
Description
While using the Halo package to implement a spinner, a MemoryError occurs when processing long text. The issue stems from a logical error in the _get_text method of the Halo class, where a condition always evaluates to true, causing the 'marquee' animation logic to execute regardless of the animation parameter's value. This results in excessive and unnecessary frame generation, leading to a rapid increase in memory usage.
System settings
- Operating System: Windows 10
- Terminal in use:
- Python version: 3.12.2
- Halo version: 0.0.31
pip freezeoutput:
Error
Traceback (most recent call last):
File "your_script.py", line 100, in
Expected behaviour
When using the Halo class, even when processing long text, memory usage should remain within normal limits, and a MemoryError should not occur.
Steps to recreate
from halo import Halo
spinner = Halo(spinner='circleQuarters', placement='right', color='magenta') spinner.start("This is a very long text that will be displayed alongside the spinner. This text is long enough to exceed the terminal's width.")
People to notify
It usually occurs on computers with low specifications.