skorokithakis/catt

consider locking protobuf dep version

chapmanjacobd opened this issue · 7 comments

After installing polars I started getting a strange error message. I think something might have changed in the protobuf library.

  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/__init__.py", line 14, in <module>
    from . import socket_client
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/socket_client.py", line 23, in <module>
    from . import cast_channel_pb2
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/cast_channel_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib64/python3.10/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
AttributeError: module 'google._upb._message' has no attribute 'Message'. Did you mean: 'CMessage'?

When updating pychromecast>=12 the error goes away -- but I get another error when trying to cast:

Exception in thread Thread-4:                                                                                                                                                 
Traceback (most recent call last):                                                                                                                                            
  File "/usr/lib64/python3.10/threading.py", line 1009, in _bootstrap_inner                                                                                                   
    self.run()                                                                                                                                                                
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/socket_client.py", line 525, in run                                           
    self.initialize_connection()                                                                                                                                              
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/socket_client.py", line 295, in initialize_connection                         
    host, port, service_info = get_host_from_service(                                                                                                                         
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/pychromecast/dial.py", line 38, in get_host_from_service                                   
    service_info = zconf.get_service_info("_googlecast._tcp.local.", service.data)                                                                                            
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/zeroconf/_core.py", line 540, in get_service_info                                          
    if info.request(self, timeout, question_type):                                                                                                                            
  File "/home/xk/.local/share/virtualenvs/lb-f3y78r55/lib/python3.10/site-packages/zeroconf/_services/info.py", line 459, in request                                          
    assert zc.loop is not None and zc.loop.is_running()                                                                                                                       
AssertionError       

After downgrading to protobuf<4 everything works now

Hmm, does this issue happen when you use pipx? Or is this more of an issue with multiple dependencies in the same env?

maybe this can be fixed in pychromecast but since catt is pinned to an old version of pychromecast people might get protobuf v4

Is that an issue? Does Catt not work with the old version?

This was fixed upstream ( thanks @chapmanjacobd ).

@skorokithakis Maybe we should pin protobuf until we get catt on a more recent version of pychromecast.

If this gets pulled in with the version of pychromecast we're using, yeah, I agree.

It does, I had issues with this earlier today. I'll make a PR (if you dont beat me to it 😃 )

I think I just did!