kinow / protobuf-uml-diagram

Create UML diagrams from Protobuf compiled .proto files using Python
https://github.com/kinow/protobuf-uml-diagram
Apache License 2.0
72 stars 12 forks source link

Having proto as a module name makes things tricky #27

Closed remohammadi closed 3 years ago

remohammadi commented 3 years ago

When I run the program with this command:

protobuf-uml-diagram --output doc --proto gs.proto.configs_data_pb2

I get:

ModuleNotFoundError: No module named 'gs_pb2'

After some initial confusion, I found the reason:

return import_module(proto.replace(".proto", "_pb2").replace("/", "."))

This innocent line which makes the application work with both module path and file path, doesn't handle mine module structure. Fortunately, because it was not proto.replace("/", ".").replace(".proto", "_pb2"), I was able to make it work with simply using / instead of .. But what would be a legit solution for this case? Having two separate click options for proto source file and proto python module?

kinow commented 3 years ago

@remohammadi

Having two separate click options for proto source file and proto python module?

Sounds like a good plan! What do you suggest we should call the command line arguments?

I am really horrible naming things :-)

Thanks!

sudeshnamukherjee commented 3 years ago

when I am trying to run dockerrun getting error: Error invoking remote method 'docker-start-container': Error: (HTTP code 400) unexpected - OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "C:/Program Files/Git/usr/bin/bash": stat C:/Program Files/Git/usr/bin/bash: no such file or directory: unknown

dockerrun.sh /C/proj/proto /C/proj/out

I am using windows 10.
I feel the issue is with this line CMD [ "/bin/bash", "./run.sh" ] in dockerfile. tried using //bin/bash. still didn't work.

kinow commented 3 years ago

@sudeshnamukherjee unless you have the same use case as @remohammadi ( having proto as module name) please report in a separate issue. In this issue we will try to fix the import of the given module, nothing specifically related to Docker.

Cheers Bruno

kinow commented 3 years ago

@remohammadi re-reading your issue description, I realized I was over-complicating, sorry. It now simply ignores if you have abc.proto.def :+1: Releasing new version in a few minutes. Thank you!