diff --git a/bob/bio/base/test/test_config_file.py b/bob/bio/base/test/test_config_file.py
index f6e7cc0f26438f12bf3c2d00651797b1f3dbd559..39e6c347ccd2d97edf48e6bcf57a771f1ee25d40 100644
--- a/bob/bio/base/test/test_config_file.py
+++ b/bob/bio/base/test/test_config_file.py
@@ -13,7 +13,7 @@ from ..script.verify import parse_arguments
 def tmp_file(contents):
   '''Generates a temporary configuration file with the contents on the input'''
 
-  retval = tempfile.NamedTemporaryFile()
+  retval = tempfile.NamedTemporaryFile('w')
   retval.write('\n'.join(contents) + '\n')
   retval.flush()
   return retval