You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The root cause is in the _get_text method of the halo.py file, specifically in the following conditional statement:
elif "marquee":
This condition always evaluates to True, causing the 'marquee' animation logic to execute even when animation is None or another value. It should be corrected as follows:
elif animation == "marquee":
By making this change, the 'marquee' animation logic will only execute when animation is explicitly set to 'marquee', ensuring that memory usage remains normal.
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
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.
The text was updated successfully, but these errors were encountered: