pychromecast: More Documentation Needed to Avoid RunTime errors

Suppose I have a cast cast and have already called cast.wait() Subsequent cast.wait()'s result in RunTimeError’s if the thread has already been run and if these errors do occur, then the self.status_event.wait(timeout=timeout) never happens. This is what I suspect indirectly causes my NotConnected errors when I try to set_volume afterwards.

I will test if the below fixes the problem for me, but before updating pychromecast by 2 years worth of code, no RunTimeError’s were being raised by cast.wait(). (EDIT: it does not fix the underlying problem).

def cast_wait():
    try:
        cast.wait(timeout=WAIT_TIMEOUT)
    except AttributeError:
        pass
    except RuntimeError:
        cast.status_event.wait(WAIT_TIMEOUT)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 38 (2 by maintainers)

Most upvoted comments

zeroconf 0.37.0 is now available. It should provide some better error reporting for cases like this

https://github.com/jstasiak/python-zeroconf/releases

I set the handler of the logger to my own so let me do some more testing.