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

Can't import pychromecast 0.6.4 on Python 2.7.9 #47

Closed
bowans opened this issue Jun 1, 2015 · 10 comments
Closed

Can't import pychromecast 0.6.4 on Python 2.7.9 #47

bowans opened this issue Jun 1, 2015 · 10 comments

Comments

@bowans
Copy link
Contributor

bowans commented Jun 1, 2015

In my test, Python 3.4.3 works fine.
But fail to import on Python 2.7.9.

Install pychromecast through pip install pychromecast
pip list -> pychromecast (0.6.4)

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pychromecast
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pychromecast\__init__.py", line 11, in <mo
dule>
    from . import socket_client
  File "C:\Python27\lib\site-packages\pychromecast\socket_client.py", line 20, i
n <module>
    from . import cast_channel_pb2
  File "C:\Python27\lib\site-packages\pychromecast\cast_channel_pb2.py", line 23
, in <module>
    serialized_pb=_b('\n\x12\x63\x61st_channel.proto\x12 extensions.core_api.cas
t_channel\"\xed\x02\n\x0b\x43\x61stMessage\x12W\n\x10protocol_version\x18\x01 \x
02(\x0e\x32=.extensions.core_api.cast_channel.CastMessage.ProtocolVersion\x12\x1
1\n\tsource_id\x18\x02 \x02(\t\x12\x16\n\x0e\x64\x65stination_id\x18\x03 \x02(\t
\x12\x11\n\tnamespace\x18\x04 \x02(\t\x12O\n\x0cpayload_type\x18\x05 \x02(\x0e\x
32\x39.extensions.core_api.cast_channel.CastMessage.PayloadType\x12\x14\n\x0cpay
load_utf8\x18\x06 \x01(\t\x12\x16\n\x0epayload_binary\x18\x07 \x01(\x0c\"!\n\x0f
ProtocolVersion\x12\x0e\n\nCASTV2_1_0\x10\x00\"%\n\x0bPayloadType\x12\n\n\x06STR
ING\x10\x00\x12\n\n\x06\x42INARY\x10\x01\"s\n\rAuthChallenge\x12\x62\n\x13signat
ure_algorithm\x18\x01 \x01(\x0e\x32\x34.extensions.core_api.cast_channel.Signatu
reAlgorithm:\x0fRSASSA_PKCS1v15\"\xc8\x01\n\x0c\x41uthResponse\x12\x11\n\tsignat
ure\x18\x01 \x02(\x0c\x12\x1f\n\x17\x63lient_auth_certificate\x18\x02 \x02(\x0c\
x12 \n\x18intermediate_certificate\x18\x03 \x03(\x0c\x12\x62\n\x13signature_algo
rithm\x18\x04 \x01(\x0e\x32\x34.extensions.core_api.cast_channel.SignatureAlgori
thm:\x0fRSASSA_PKCS1v15\"\xa8\x01\n\tAuthError\x12I\n\nerror_type\x18\x01 \x02(\
x0e\x32\x35.extensions.core_api.cast_channel.AuthError.ErrorType\"P\n\tErrorType
\x12\x12\n\x0eINTERNAL_ERROR\x10\x00\x12\n\n\x06NO_TLS\x10\x01\x12#\n\x1fSIGNATU
RE_ALGORITHM_UNAVAILABLE\x10\x02\"\xd5\x01\n\x11\x44\x65viceAuthMessage\x12\x42\
n\tchallenge\x18\x01 \x01(\x0b\x32/.extensions.core_api.cast_channel.AuthChallen
ge\x12@\n\x08response\x18\x02 \x01(\x0b\x32..extensions.core_api.cast_channel.Au
thResponse\x12:\n\x05\x65rror\x18\x03 \x01(\x0b\x32+.extensions.core_api.cast_ch
annel.AuthError*J\n\x12SignatureAlgorithm\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x
13\n\x0fRSASSA_PKCS1v15\x10\x01\x12\x0e\n\nRSASSA_PSS\x10\x02\x42\x02H\x03')
TypeError: __init__() got an unexpected keyword argument 'syntax'
>>>
@c-steindl
Copy link

+1 from me. I also get Requested protobuf>=3.0.0a2 (from pychromecast), but installing version 3.0.0a1 during installation via pip. Looks like there is no member variable syntax in protobof class class FileDescriptor(DescriptorBase): in that version.

@balloob
Copy link
Collaborator

balloob commented Jun 2, 2015

@Steindi01, you're on the right track there. I think it has to do with the protobuf version. I have just pushed a new version 0.6.4.1 that depends on the recently released protobuf version 3.0.0a3.

Importing PyChromecast on Python 2 works for me with that version.

@bowans
Copy link
Contributor Author

bowans commented Jun 2, 2015

Hi @balloob,
pychromecast 0.6.4.1 still fails for me, but I find some clues about pip.

Install formal Python 2.7.9 from Python 2.7.9 Windows x86 MSI installer .
The installation may default to install pip (1.5.6).
pip install -r requirement.txt will get protobuf (3.0.0-alpha-1) at this time.

But if upgrade pip to pip (7.0.3) via pip install --upgrade pip.
pip install -r requirement.txt will install correct protobuf (3.0.0a3).

If using pip (7.0.3) for pip install pychromecast, importing pychromecast will be OK.

@balloob
Copy link
Collaborator

balloob commented Jun 2, 2015

Okay, that is weird. For now, I'll add a note to the README with your workaround.

@chrisgilmerproj
Copy link

Just a hint here, when using the python shell python at version 2.7.10 it works fine. If I use ipython instead at version 1.1.0 it didn't work at all. Upgrading ipython to version 3.1.0 (I was really behind here) seemed to resolve this issue for me.

@skorokithakis
Copy link

I got the same issue, upgraded pip and installed from master and it was solved. I'm not sure why, but it was.

@skorokithakis
Copy link

Can confirm this also works fine with pip 8 and Python 2.7.

@manatlan
Copy link

manatlan commented Feb 1, 2016

I confirm : it works better with a up-to-date pip

@clach04
Copy link
Contributor

clach04 commented Oct 6, 2020

Stumbled across #130 and #47. Ended up sticking with Python3 (was simply testing Python 2.7) but did see https://github.com/skorokithakis/catt which documents that catt version 0.5.6 has python 2 support in case anyone really needs Python 2.7 support.

@emontnemery
Copy link
Collaborator

Pychromecast is Python 3 only since quite some time

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

8 participants