Open Ravencentric opened 1 year ago
Yes, that is odd indeed. I cannot reproduce it. Everything seems to work for me (macOS). I see you are using Windows, right? I bet it is ignoring some ANSI Escape Code somehow. But unfortunately, I cannot test it on a win machine.
Please, what happens if you force a \n
in there?
print("this text will get deleted\n")
Same thing, it ends up "eating" away the newline. I was able to reproduce this on a different windows machine so it's likely a Windows issue. Don't have any unix machine on me to test.
If I remove the print statement entirely, then it'll delete the prompt
Have you tried cmd prompt? \n works for me.
In PowerShell the newline character is `n
I get the same result. I'm on Windows 11 Pro 22H2 if that matters.
I used the below code from the first post and it works for me. I'm on Windows 11 Enterprise 22H2
from pathlib import Path
from time import sleep
from alive_progress import alive_it, config_handler
config_handler.set_global(length=50, theme="classic", dual_line=True)
files = list(Path.cwd().glob("*"))
bar = alive_it(files, title="TEST")
print("this text will get deleted")
for file in bar:
file_type = "Folder" if file.is_dir() else "File"
bar.text(f"{file_type}: {file.name}")
sleep(1)
Could it be because we are on different versions?
Reproducible on my machine, changing dual_line to False also fixes it other than removing the lines raven mentioned.
Thanks @jspilinek for the help! I think it is up to you Windows devs to figure this out... I'll be a spectator here.
@Ravencentric I see you have (test-py3.11) in your cmd and powershell prompt. Maybe this is causing your issue?
Here's my Python version and alive-progress version
>python --version
Python 3.11.5
>pip list
Package Version
--------------- ------------
about-time 4.2.1
alive-progress 3.1.4
grapheme 0.6.0
numpy 1.26.0
pandas 2.1.1
pip 23.2.1
python-dateutil 2.8.2
pytz 2023.3.post1
setuptools 65.5.0
six 1.16.0
tzdata 2023.3
That's just the python venv im using to isolate any other package from interfering
> python --version
Python 3.11.5
> pip list
Package Version
-------------- -------
about-time 4.2.1
alive-progress 3.1.4
grapheme 0.6.0
pip 23.2.1
setuptools 68.1.2
wheel 0.41.2
Here, running it with global python instead:
If I remove
bar.text(f"{file_type}: {file.name}")
, then it works as expected:If I remove
file_type = "Folder" if file.is_dir() else "File"
, again it works:From what I can gather, evaluating anything in
file_type
from the above example causes this. Getting rid of either this orbar.text
fixes it at the cost of well not being able to do what I want. Same happens if I use any arbitrary function like: