I have debug the code in 
"/usr/local/lib/python3.5/dist-packages/protobuf3/compiler/__init__.py" and 
here is what I have found:

(1)  in "file_to_import = 
splitext(self.__tle_map[top_level_name])[0].replace('/', '.')"

top_level_name is "google"

self.__tle_map is 
[INFO] 2017-12-25 12:22:59,476 MainThread __init__.py 149 tle_map: {'Any': 
'google/protobuf/any.proto', 'ErrorStatus': 'protobuftest.proto'}

obviously, top_level_name is "Any" will be the correct answer. 
In the protobuftest.proto,  the message is "google.protobuf.Any" and the 
first word "google" is taken as top_level_name.
It seems, there should be a lack of strip to the package names .

Not quite sure. Hope any one is interested in this problem.

Merry Christmas and Happy New Year !

best
Delvin 


On Monday, December 25, 2017 at 12:18:29 PM UTC+8, Delvin Pan wrote:
>
> Hi All,
>
> I have been using protobuf3 for a while and it works most of time, until I 
> try to use package google.protobuf.timestamp.
>
> Here is the problems:
>
> os : ubuntu 16.04
>
> protoc installment : follwing the instruments in  
> https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8
>
> python protobuf3 installment:  sudo pip3 install protobuf3
>
> test code: protobuftest.proto  in the attachment
>
> cmd to run: 
>
> protoc -I=.  --python3_out=. protobuftest.proto
>
> Result: 
>
> Traceback (most recent call last):
>   File "/usr/local/bin/protoc-gen-python3", line 36, in <module>
>     compiler = Compiler(desc_map[file_name], top_level_elements)
>   File 
> "/usr/local/lib/python3.5/dist-packages/protobuf3/compiler/__init__.py", 
> line 54, in __init__
>     self.process_message(message)
>   File 
> "/usr/local/lib/python3.5/dist-packages/protobuf3/compiler/__init__.py", 
> line 104, in process_message
>     self.process_field(message.name, field, embedded)
>   File 
> "/usr/local/lib/python3.5/dist-packages/protobuf3/compiler/__init__.py", 
> line 148, in process_field
>     file_to_import = 
> splitext(self.__tle_map[top_level_name])[0].replace('/', '.')
> KeyError: 'google'
> --python3_out: protoc-gen-python3: Plugin failed with status code 1.
>
> Thanks a lot for your help.
>
> best
> Delvin
>
>
>
>
>

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to