alive-progress: Crash when reusing logging Handlers with unhashable type: 'types.SimpleNamespace'

Hello, First of all thank you for all the effort you’ve put in to this project so far.

I am running into an issue I can’t seem to resolve and would love it if you could give your opinion.

I am trying to use both alive-progress and sshtunnel together. All I’ve done is create the sshtunnel definition before the alive example code as below, and I am getting the error from the headline :\

from alive_progress import alive_bar
import time
from sshtunnel import SSHTunnelForwarder

ssh_tun = SSHTunnelForwarder(
    "0.0.0.0",
    ssh_username="mooo",
    remote_bind_address=('127.0.0.1', 8080)
)

for x in 1000, 1500, 700, 0:
    with alive_bar(x) as bar:
        for i in range(1000):
            time.sleep(.005)
            bar()

Thoughts? Thank you in advance for any reply.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hey, this is fixed!! Should be available in the next release! 👍

Hi folks!

I’d just like to let you know I’m committing it at this exact moment! Should be released soon!! 👍

Thanks, @Crinibus, you have a great week!! 👋

Thanks for the example @emanuelen5, I’ll use it to fix this!

Same with me. Conflict with logging when I set individual loggers. unhashable type: 'types.SimpleNamespace

Hello @aviadfiant, thank you, man!

Well, it does seem similar to that one @TheTechRobo has reminded us of, but it is different. This SSHTunnelForwarder uses logging internally, but in a kinda unusual way: it reuses handlers

image

Note the highlighted ids, they are the addresses of some object, all pointing to the same Handler 107c648c8. So, when alive-progress processes them, it tries to instrument again an already ready handler, and thus it breaks like in a nested use case…

I’ll support this case in a new version 👍