diff --git a/project.py b/project.py
index 281ba4b742e5bd14d5cb231aa2f6ebc7a0817ea5..77b97f73902d8019d22ca7a50a070905f35ef92d 100644
--- a/project.py
+++ b/project.py
@@ -1989,7 +1989,7 @@ class Project(object):
       gitmodules_lines = []
       fd, temp_gitmodules_path = tempfile.mkstemp()
       try:
-        os.write(fd, p.stdout)
+        os.write(fd, p.stdout.encode('utf-8'))
         os.close(fd)
         cmd = ['config', '--file', temp_gitmodules_path, '--list']
         p = GitCommand(None, cmd, capture_stdout=True, capture_stderr=True,