malthe / google-protobuf

Protocol Buffers - Google's data interchange format
Other
13 stars 9 forks source link

Python error: unicode reference in descriptor_pb2.py during setup.py test #1

Open jasonmyers opened 11 years ago

jasonmyers commented 11 years ago

Hi, I'm getting error running the tests after installation.

Environment (in a Python 3 virtualenv):

~/ $ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.8.4
~/ $ python -V
Python 3.3.2
~/ $ protoc --version
libprotoc 2.5.0

python setup.py build seems to work fine (no errors)

~/projects/google-protobuf/python $ python setup.py build
running build
running build_py
Generating google/protobuf/descriptor_pb2.py...
Generating google/protobuf/compiler/plugin_pb2.py...
...<truncated>...
copying google/__init__.py -> build/lib/google

But then python setup.py test fails on a unicode reference:

~/projects/google-protobuf/python $ python setup.py test
running test
running egg_info
creating protobuf.egg-info
...<truncated>...
Generating google/protobuf/internal/factory_test1_pb2.py...
Generating google/protobuf/internal/factory_test2_pb2.py...
Traceback (most recent call last):
...<truncated>...
"/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/unittest/loader.py", line 122, in loadTestsFromName
    test = obj()
  File "/Users/jmyers/projects/google-protobuf/python/setup.py", line 90, in MakeTestSuite
    import google.protobuf.internal.generator_test     as generator_test
  File "/Users/jmyers/projects/google-protobuf/python/google/protobuf/internal/generator_test.py", line 45, in <module>
    from google.protobuf.internal import test_bad_identifiers_pb2
  File "/Users/jmyers/projects/google-protobuf/python/google/protobuf/internal/test_bad_identifiers_pb2.py", line 9, in <module>
    from google.protobuf import descriptor_pb2
  File "/Users/jmyers/projects/google-protobuf/python/google/protobuf/descriptor_pb2.py", line 218, in <module>
    has_default_value=False, default_value=unicode("", "utf-8"),
NameError: name 'unicode' is not defined

I see a bunch of these default_value=unicode("", "utf-8") references in the generated descriptor_pb2.py file. Any ideas?

ftomassetti commented 9 years ago

same problem here...