{"action":"created","issue":{"url":"https://api.github.com/repos/google/protobuf/issues/1491","repository_url":"https://api.github.com/repos/google/protobuf","labels_url":"https://api.github.com/repos/google/protobuf/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/google/protobuf/issues/1491/comments","events_url":"https://api.github.com/repos/google/protobuf/issues/1491/events","html_url":"https://github.com/google/protobuf/issues/1491","id":153287065,"number":1491,"title":"python: use relative imports in generated modules","user":{"login":"little-dude","id":6646324,"avatar_url":"https://avatars.githubusercontent.com/u/6646324?v=3","gravatar_id":"","url":"https://api.github.com/users/little-dude","html_url":"https://github.com/little-dude","followers_url":"https://api.github.com/users/little-dude/followers","following_url":"https://api.github.com/users/little-dude/following{/other_user}","gists_url":"https://api.github.com/users/little-dude/gists{/gist_id}","starred_url":"https://api.github.com/users/little-dude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/little-dude/subscriptions","organizations_url":"https://api.github.com/users/little-dude/orgs","repos_url":"https://api.github.com/users/little-dude/repos","events_url":"https://api.github.com/users/little-dude/events{/privacy}","received_events_url":"https://api.github.com/users/little-dude/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-05T17:57:42Z","updated_at":"2016-05-11T04:50:06Z","closed_at":null,"body":"I have a package `foo` that looks like this:\r\n\r\n```\r\n.\r\n├── data\r\n│   ├── a.proto\r\n│   └── b.proto\r\n└── generated\r\n    ├── a_pb2.py\r\n    ├── b_pb2.py\r\n    └── __init__.py\r\n```\r\n\r\n```\r\n# a.proto\r\npackage foo;\r\n```\r\n\r\n```\r\n# b.proto\r\nimport \"a.proto\";\r\n\r\npackage foo;\r\n```\r\n\r\nGenerate the code: `protoc -I ./data --python_out=generated data/a.proto data/b.proto`.\r\nHere is the failure:\r\n\r\n```\r\nPython 3.5.1 (default, Mar  3 2016, 09:29:07) \r\n[GCC 5.3.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> from generated import b_pb2\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/home/corentih/repro/generated/b_pb2.py\", line 16, in <module>\r\n    import a_pb2\r\nImportError: No module named 'a_pb2'\r\n```\r\n\r\nThis is beacuse the generated code looks like this:\r\n\r\n```\r\nimport a_pb2\r\n```\r\n\r\nIf the import was relative it would actually work:\r\n\r\n```\r\nfrom . import a_pb2\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/google/protobuf/issues/comments/218361120","html_url":"https://github.com/google/protobuf/issues/1491#issuecomment-218361120","issue_url":"https://api.github.com/repos/google/protobuf/issues/1491","id":218361120,"user":{"login":"goldenbull","id":9129006,"avatar_url":"https://avatars.githubusercontent.com/u/9129006?v=3","gravatar_id":"","url":"https://api.github.com/users/goldenbull","html_url":"https://github.com/goldenbull","followers_url":"https://api.github.com/users/goldenbull/followers","following_url":"https://api.github.com/users/goldenbull/following{/other_user}","gists_url":"https://api.github.com/users/goldenbull/gists{/gist_id}","starred_url":"https://api.github.com/users/goldenbull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldenbull/subscriptions","organizations_url":"https://api.github.com/users/goldenbull/orgs","repos_url":"https://api.github.com/users/goldenbull/repos","events_url":"https://api.github.com/users/goldenbull/events{/privacy}","received_events_url":"https://api.github.com/users/goldenbull/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T04:50:06Z","updated_at":"2016-05-11T04:50:06Z","body":"@little-dude how about if `a_pb2.py` is generated into a different folder as `b_pb2.py`?"}}