Comment #11 on issue 153 by ctuf...@gmail.com: 2.3 Python code not importing
http://code.google.com/p/protobuf/issues/detail?id=153

I ran into the problem described in #9, but instead of removing or renaming the 2.2 install, I had success linking the desired protobuf Python modules to the generator directory. For example,

[2220] pwd
/home/ctuffli/dev/nanopb-0.2.1/generator
[2221] make
protoc --python_out=. -I /usr/include -I . nanopb.proto
[2222] pushd
~/dev/nanopb-0.2.1/example ~/dev/nanopb-0.2.1/generator
[2223] make
protoc -I. -I../generator -I/usr/include -ofileproto.pb fileproto.proto
python ../generator/nanopb_generator.py fileproto.pb

***************************************************************
*** Could not import the precompiled nanopb_pb2.py.         ***
*** Run 'make' in the 'generator' folder to update the file.***
***************************************************************

Traceback (most recent call last):
  File "../generator/nanopb_generator.py", line 17, in <module>
    import nanopb_pb2
File "/home/ctuffli/dev/nanopb-0.2.1/generator/nanopb_pb2.py", line 12, in <module>
    DESCRIPTOR = descriptor.FileDescriptor(
AttributeError: 'module' object has no attribute 'FileDescriptor'
make: *** [fileproto.pb.h] Error 1
[2224] pushd
~/dev/nanopb-0.2.1/generator ~/dev/nanopb-0.2.1/example
[2225] rm nanopb_pb2.py*
[2226] ln -s /home/ctuffli/dev/protobuf-2.4.1/python/google .
[2227] make
protoc --python_out=. -I /usr/include -I . nanopb.proto
[2228] pushd
~/dev/nanopb-0.2.1/example ~/dev/nanopb-0.2.1/generator
[2229] make
protoc -I. -I../generator -I/usr/include -ofileproto.pb fileproto.proto
python ../generator/nanopb_generator.py fileproto.pb
Writing to fileproto.pb.h and fileproto.pb.c
cc -ansi -Wall -Werror -I .. -g -O0 -o server server.c ../pb_decode.c ../pb_encode.c fileproto.pb.c common.c cc -ansi -Wall -Werror -I .. -g -O0 -o client client.c ../pb_decode.c ../pb_encode.c fileproto.pb.c common.c


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to