Thanks. That worked. However, when I run my testfile.py I get the following 
error:
[localhost git]$ python testfile.py 
Traceback (most recent call last):
  File "testfile.py", line 4, in <module>
    import test
  File "[...]/Documents/git/test.py", line 4, in <module>
    import proto.DSMessagesv3_pb2 as msg
  File "[...]/Documents/git/proto/DSMessagesv3_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/usr/lib/python2.7/site-packages/google/protobuf/descriptor.py", 
line 50, in <module>
    from google.protobuf.pyext import _message
ImportError: cannot import name _message


>From the descriptor.py file here is where it fails:
  if api_implementation.Version() == 2:
    from google.protobuf.pyext import _message
  else:
    from google.protobuf.internal import cpp_message

Also, before I ran my file I export the following environment variables per 
README file in the python folder.

$ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
$ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2




On Monday, August 1, 2016 at 5:17:42 PM UTC-6, Paul Johnston wrote:
>
> "--cpp_implementaion" misspelled, should be "--cpp_implementation"
>
> On Monday, August 1, 2016 at 1:28:29 PM UTC-6, Oi Lee wrote:
>>
>> When I do 
>> [localhost python]$ sudo python setup.py build --cpp_implementaion
>>
>> Installed 
>> [...]/protobuf-2.6.1/python/.eggs/google_apputils-0.4.2-py2.7.egg
>> Searching for python-gflags>=1.4
>> Reading https://pypi.python.org/simple/python-gflags/
>> Best match: python-gflags 3.0.5
>> Downloading 
>> https://pypi.python.org/packages/1f/01/3ca6527f51b7ff26abb635d4e7e2fa8413c7cf191564cc2c1e535f50dec7/python-gflags-3.0.5.tar.gz#md5=0e3a06cb99b9883bf6abacc489f31297
>> Processing python-gflags-3.0.5.tar.gz
>> Writing /tmp/easy_install-c_jdOd/python-gflags-3.0.5/setup.cfg
>> Running python-gflags-3.0.5/setup.py -q bdist_egg --dist-dir 
>> /tmp/easy_install-c_jdOd/python-gflags-3.0.5/egg-dist-tmp-M2uDeX
>> zip_safe flag not set; analyzing archive contents...
>> Moving python_gflags-3.0.5-py2.7.egg to 
>> /home/oi.lee/Downloads/protobuf-2.6.1/python/.eggs
>>
>> Installed [...]/protobuf-2.6.1/python/.eggs/python_gflags-3.0.5-py2.7.egg
>> Searching for python-dateutil>=1.4
>> Reading https://pypi.python.org/simple/python-dateutil/
>> Best match: python-dateutil 2.5.3
>> Downloading 
>> https://pypi.python.org/packages/b7/9f/ba2b6aaf27e74df59f31b77d1927d5b037cc79a89cda604071f93d289eaf/python-dateutil-2.5.3.zip#md5=52b3f339f41986c25c3a2247e722db17
>> Processing python-dateutil-2.5.3.zip
>> Writing /tmp/easy_install-F99Iys/python-dateutil-2.5.3/setup.cfg
>> Running python-dateutil-2.5.3/setup.py -q bdist_egg --dist-dir 
>> /tmp/easy_install-F99Iys/python-dateutil-2.5.3/egg-dist-tmp-YXfHJw
>> warning: no previously-included files matching '__pycache__' found 
>> anywhere in distribution
>> warning: no previously-included files matching '*.py[co]' found anywhere 
>> in distribution
>> Moving python_dateutil-2.5.3-py2.7.egg to 
>> /home/oi.lee/Downloads/protobuf-2.6.1/python/.eggs
>>
>>
>> Installed [...]/protobuf-2.6.1/python/.eggs/python_dateutil-2.5.3-py2.7.egg
>> usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>>    or: setup.py --help [cmd1 cmd2 ...]
>>    or: setup.py --help-commands
>>    or: setup.py cmd --help
>>
>> error: option --cpp_implementaion not recognized
>>
>>
>>
>> On Friday, July 29, 2016 at 3:25:10 PM UTC-6, Jie Luo wrote:
>>>
>>>  I tried and it returns 'cpp' as expected.
>>>
>>> First, make sure you use the correct commands:
>>> python setup.py build --cpp_implementaion
>>> python setup.py install --cpp_implementaion
>>>
>>>
>>> Second, Where do you put your .py file to check 
>>> api_implementation.Type()? Make sure your file does not under 
>>> protobuf/python (DO NOT in the same directory as setup.py)
>>>
>>> On Fri, Jul 29, 2016 at 12:30 PM, Feng Xiao <[email protected]> wrote:
>>>
>>>> +Jie
>>>>
>>>> On Fri, Jul 29, 2016 at 10:10 AM, Oi Lee <[email protected]> wrote:
>>>>
>>>>> I initially used a pure python implementation of protocol buffers, but 
>>>>> I changed it later to use the c++ library implementation. So I installed 
>>>>> protobuf using these github instructions 
>>>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogle%2Fprotobuf%2Fblob%2Fmaster%2Fsrc%2FREADME.md&sa=D&sntz=1&usg=AFQjCNG2r1BsKNbsZQp7Tx0dL3_pTM1fNg>
>>>>>  and 
>>>>> then I followed these instructions 
>>>>> <https://github.com/google/protobuf/blob/master/python/README.md> to 
>>>>> use the C++ implementation. But when I use  api_implementation.Type() 
>>>>> <https://cs.corp.google.com/piper///depot/google3/net/proto2/python/internal/api_implementation.py?is_navigation=1&q=package:%5E(piper)$+file:(%5E)//depot/google3/net/proto2/python/internal/api_implementation(%5C.(swig%7Cpy%7Cspt)$%7C/(__init__%5C.(swig%7Cpy%7Cspt))?$)&l=79>,
>>>>>  it 
>>>>> still returns 'python'.  Why is it still using the python implementation? 
>>>>>  
>>>>> If this function should not be used, then what should I use to check 
>>>>> implementation? 
>>>>> I'm using protocol buffers 2.6.1 on CentOS. 
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Protocol Buffers" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to