New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counter Attempt to Format the desc and unit Arguments #45
Comments
This is because Enlighten uses str.format() internally to do variable substitution. To escape a curly brace, you need to double it.
Let me know if that resolves your issue. |
Yes. I just thought it can be solved in the library, or at least be documented (if it was, I missed it). Note: In my case the values are generated dynamically (os.walk of an unknown client) so I used: with enlighten.Counter(total=1, desc=path.replace('{', '{{').replace('}', '}}')) as pbar:
pass which solved the issue for me. Thanks for the quick response P.S: |
I just pushed a commit to take care of it. Let me know if it works for you. It would probably still be a good idea to add tests to protect against regression. |
Checked it on my sample and it worked great! |
Released in 1.10.2 |
Thank you! |
Describe the bug
Enlighten Counter try to format the description/unit fields - it will cause issues if '{' or '}' are present, in most cases raising ValueError.
This happen in both progress bar and counter modes.
To Reproduce
Environment (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: