Skip to content

Commit

Permalink
python: force relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
little-dude committed May 10, 2016
1 parent 4c6259b commit 0c88eef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/python/python_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ string ModuleImportStatement(const string& filename) {
if (last_dot_pos == string::npos) {
// NOTE(petya): this is not tested as it would require a protocol buffer
// outside of any package, and I don't think that is easily achievable.
return "import " + module_name;
return "from . import " + module_name;
} else {
return "from " + module_name.substr(0, last_dot_pos) + " import " +
module_name.substr(last_dot_pos + 1);
Expand Down

0 comments on commit 0c88eef

Please sign in to comment.