[python-bugzilla] python-bugzilla issue on F22?

Joe Orton jorton at redhat.com
Wed Jul 22 08:59:29 UTC 2015


On Mon, Jul 13, 2015 at 10:26:36AM +0300, Alexander Todorov wrote:
...
> >data must be a byte string
> >$ rpm -qf /usr/bin/bugzilla
> >python-bugzilla-1.2.1-1.fc22.noarch
> >
> >Any help appreciated!
> >
> 
> Hi Joe,
> check out this bug:
> https://bugzilla.redhat.com/show_bug.cgi?id=1241561

It's not that.  I'm confused though - is everybody else using 
python-bugzilla successfully on Fedora 22, or has nobody else tried it?

I tracked down the error, anyway.

The exception originates from pyOpenSSL's Connection.send(), which has:

        if not isinstance(buf, bytes):
            raise TypeError("data must be a byte string")

The reason is that the passed-in buffer is a unicode object rather than 
a byte string.

python-bugzilla's RequestsTransport.request() does this, which I don't 
understand:

        # Needed for python-requests < 2.0 with python3, otherwise we get
        # Content-Type error later for the POST request
        request_body = request_body.decode('utf-8')

Is the problem that some versions of python-requests want a unicode 
object and some want a UTF-8-encoded string (str object)?  Flipping the 
decode to an encode fixes the problem for me, ensuring request_body is a 
str object not a unicode object.  For reference, package versions:

python-requests-2.7.0-1.fc22.noarch
python-bugzilla-1.2.1-1.fc22.noarch
pyOpenSSL-0.14-3.fc22.noarch


Regards, Joe

-- 
Joe Orton // Red Hat // Web Stack Team // webstack-team at redhat.com // @notroj


More information about the python-bugzilla mailing list