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

Cole Robinson crobinso at redhat.com
Wed May 28 12:28:21 UTC 2014


On 05/26/2014 03:45 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 with Python 3.4.1 on Windows.
> ---
>  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)
>  
> 

ACK and pushed.

Thanks,
Cole


More information about the python-bugzilla mailing list