[python-bugzilla] [PATCH] Fix for writing tokenfile on python3

Leif Gruenwoldt leifer at gmail.com
Fri May 23 21:21:23 UTC 2014


The tokenfile must be opened in text mode to avoid an error on write:

TypeError: 'str' does not support the buffer interface

https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.write

Tested on Python 3.4.1.
---
 bugzilla/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bugzilla/base.py b/bugzilla/base.py
index ca107b4..84d4be3 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -135,7 +135,7 @@ class _BugzillaToken(object):
             self.tokenfile.set(self.domain, 'token', value)
 
         if self.tokenfilename:
-            with open(self.tokenfilename, 'wb') as tokenfile:
+            with open(self.tokenfilename, 'w') as tokenfile:
                 log.debug("Saving to tokenfile")
                 self.tokenfile.write(tokenfile)
 
-- 
1.9.0.msysgit.0



More information about the python-bugzilla mailing list