Skip to content

Python 3 and protobuf #25

@Tinche

Description

@Tinche

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions