[python-bugzilla] python-bugzilla issue on F22?
Cole Robinson
crobinso at redhat.com
Wed Jul 22 14:56:26 UTC 2015
On 07/22/2015 04:59 AM, Joe Orton wrote:
> 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
>
>
$ rpm -q python-requests python-bugzilla pyOpenSSL
python-requests-2.7.0-1.fc22.noarch
python-bugzilla-1.2.1-1.fc22.noarch
pyOpenSSL-0.14-3.fc22.noarch
$ bugzilla --debug login jorton foo
[10:52:25] INFO (bugzilla:1160) Connecting to
https://bugzilla.redhat.com/xmlrpc.cgi
[10:52:25] INFO (bugzilla:1163) Autodetecting Bugzilla type
[10:52:25] DEBUG (__init__:39) Detecting subclass for
https://bugzilla.redhat.com/xmlrpc.cgi
[10:52:25] INFO (__init__:46) Using RHBugzilla for URL containing
bugzilla.redhat.com
[10:52:25] INFO (__init__:114) Chose subclass RHBugzilla v0.1
[10:52:25] DEBUG (base:420) Using tokenfile=/home/crobinso/.bugzillatoken
[10:52:25] DEBUG (base:537) Using cookiefile=/home/crobinso/.bugzillacookies
[10:52:25] INFO (base:676) Using username/password for authentication
[10:52:25] INFO (base:684) Logging in...
Login failed: The username or password you entered is not valid.
I'm guessing you have some outdated python dep somewhere in your python path.
Check python -c 'import sys; print sys.path' non-system paths for any stale
installs.
- Cole
More information about the python-bugzilla
mailing list