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

Leif Gruenwoldt leifer at gmail.com
Mon Jun 9 14:58:37 UTC 2014


Thanks Cole. Much appreciated!

(The reason for the dupe email was I had first submitted the patch as
a non registered mailing list member and figured it was sitting in a
queue somewhere, so I registered and resent.)

On Mon, Jun 9, 2014 at 10:50 AM, Cole Robinson <crobinso at redhat.com> wrote:
> On 05/23/2014 05:21 PM, Leif Gruenwoldt wrote:
>> 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)
>>
>>
>
> I applied your patch for this already:
>
> commit af1a5656fec1dbbe0afeb27091464084532e3c58
> Author: Leif Gruenwoldt <leifer at gmail.com>
> Date:   Mon May 26 15:45:43 2014 -0400
>
>     Fix for writing tokenfile on python3 on windows
>
> - Cole


More information about the python-bugzilla mailing list