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

Python 3 and protobuf #25

Open
Tinche opened this issue Feb 23, 2016 · 0 comments
Open

Python 3 and protobuf #25

Tinche opened this issue Feb 23, 2016 · 0 comments

Comments

@Tinche
Copy link

Tinche commented Feb 23, 2016

Currently, the protobuf package on PyPI doesn't work on Python 3. It will install, but try using it:

# python
Python 3.5.1 (default, Dec 15 2015, 14:52:59)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf import reflection
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ttvrtkovic/pg/.venv/lib/python3.5/site-packages/google/protobuf/reflection.py", line 68, in <module>
    from google.protobuf.internal import python_message
  File "/Users/ttvrtkovic/pg/.venv/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 848
    except struct.error, e:
                       ^
SyntaxError: invalid syntax

Cool, huh? So for the time being, bernhard is Python 2 only I guess.

There's a Python 3 fork called 'python3_protobuf', used by for example the Riak client (https://github.com/basho/riak-python-client/blob/master/setup.py). Do you think bernhard could work with this version? If so, I'd suggest conditionally depending on protobuf on Python 2 and python3_protobuf on Python 3.

(But I wouldn't do it like in the linked Riak setup.py, but rather like this: https://github.com/pytest-dev/pytest-asyncio/blob/master/setup.py#L47

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

1 participant