halo icon indicating copy to clipboard operation
halo copied to clipboard

there is logical bug in code

Open kim2002zz opened this issue 1 year ago • 1 comments

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 freeze output:

Error

Traceback (most recent call last): File "your_script.py", line 100, in spinner = Halo(spinner='circleQuarters', placement='right', color='magenta') File "halo\halo.py", line 112, in init MemoryError

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.

kim2002zz avatar Nov 04 '24 14:11 kim2002zz