Skip to content

there is logical bug in code #186

Description

@kim2002zz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions