Skip to content
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

TypeError when using nested bars in 2.0.0 #98

Closed
haukebruno opened this issue Aug 10, 2021 · 7 comments
Closed

TypeError when using nested bars in 2.0.0 #98

haukebruno opened this issue Aug 10, 2021 · 7 comments

Comments

@haukebruno
Copy link

I tried the 2.0.0 release (or release candidate) today to have nested progress bars.

My testing code is:

from time import sleep
from alive_progress import alive_bar

with alive_bar() as customer_bar:
    for customer in ['acmecorp', 'examplecorp', 'foo']:

        print('Start working on customer: ' + customer)

        with alive_bar() as action_bar:
            for action in ['setup', 'install', 'configure', 'finish']:

                print('Performing action ' + action)
                sleep(2)
                action_bar()
        
        sleep(5)
        customer_bar()

Which results in an error:

File "/Users/hauke/tmp/pybar/foo.py", line 14, in <module>
    print('Performing action ' + action)
  File "/Users/hauke/tmp/pybar/testfoo/lib/python3.9/site-packages/alive_progress/core/hook_manager.py", line 36, in write
    buffer = buffers[stream]
TypeError: unhashable type: 'types.SimpleNamespace'

Disclaimer: I'm pretty new to Python (and programming at all) 🙈

@rsalmei
Copy link
Owner

rsalmei commented Aug 11, 2021

Hello @haukebruno,

There isn't support for multiple nested bars yet.
I explained this recently in #95, and there's another ticket open for a long time in #20.
Unfortunately it isn't simple, but I still would like to support that some day.

@rsalmei rsalmei closed this as completed Aug 11, 2021
@rsalmei rsalmei mentioned this issue Jul 28, 2022
@radugrosu
Copy link

Sorry to comment on an old thread, I understand that nested bars are not supported yet, but it would be great if the application didn't crash.

@rsalmei
Copy link
Owner

rsalmei commented May 23, 2023

No problem, man. Well, if it is not supported it has to crash somehow. You mean, perhaps with a cleaner error message?

@radugrosu
Copy link

radugrosu commented May 24, 2023

Yes, a more specific error message would actually be great. It happened to me recently that I added a progress bar in a utility where one of the callers was also using a progress bar and the resulting crash was pretty confusing there for a minute. Thanks

@rsalmei
Copy link
Owner

rsalmei commented May 26, 2023

Done, it will be on the next version: 3.1.3.

image

@radugrosu
Copy link

Thanks a lot!

@rsalmei
Copy link
Owner

rsalmei commented May 26, 2023

You're welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants