XMLRPCTransport is incompatible with python 2.7

Bug #612096 reported by HansLambermont on 2010-07-31
74
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Bazaar
High
Toshio Kuratomi
Gentoo Linux
Fix Released
Medium

Bug Description

1) output
2) bzr.log

1) 20100731_191050 stellarium@gcc14:~/tmp/ bzr checkout lp:stellarium source
bzr: ERROR: exceptions.AttributeError: addinfourl instance has no attribute 'getheader'

Traceback (most recent call last):
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 911, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 1111, in run_bzr
    ret = run(*run_argv)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 689, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 704, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/builtins.py", line 1321, in run
    branch_location)
  File "/home/stellarium/lib/python2.7/bzrlib/bzrdir.py", line 1032, in open_tree_or_branch
    bzrdir = klass.open(location)
  File "/home/stellarium/lib/python2.7/bzrlib/bzrdir.py", line 910, in open
    t = get_transport(base, possible_transports=possible_transports)
  File "/home/stellarium/lib/python2.7/bzrlib/lazy_import.py", line 125, in __call__
    return obj(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/transport/__init__.py", line 1569, in get_transport
    base = directories.dereference(base)
  File "/home/stellarium/lib/python2.7/bzrlib/directory_service.py", line 58, in dereference
    return service().look_up(name, url)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_directory.py", line 59, in look_up
    return self._resolve(url)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_directory.py", line 69, in _resolve
    result = resolve.submit(service)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 272, in submit
    self._authenticated)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 195, in send_request
    result = method(*method_params)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 78, in request
    return self.parse_response(response)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1449, in parse_response
    if response.getheader("Content-Encoding", "") == "gzip":
AttributeError: addinfourl instance has no attribute 'getheader'

bzr 2.2b4 on python 2.7.0 (Linux-2.6.26-2-vserver-amd64-x86_64-with-debian-5.0.3)
arguments: ['/home/stellarium/bin/bzr', 'checkout', 'lp:stellarium', 'source']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bash_completion /home/stellarium/lib/python2.7/bzrlib/plugins/bash_completion [2.2b4]
  launchpad /home/stellarium/lib/python2.7/bzrlib/plugins/launchpad [2.2b4]
  netrc_credential_store /home/stellarium/lib/python2.7/bzrlib/plugins/netrc_credential_store [2.2b4]
  news_merge /home/stellarium/lib/python2.7/bzrlib/plugins/news_merge [2.2b4]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

2) ~/bzr.log :

Sat 2010-07-31 19:12:43 +0200
0.034 bazaar version: 2.2b4
0.034 bzr arguments: [u'checkout', u'lp:stellarium', u'source']
0.037 looking for plugins in /home/stellarium/.bazaar/plugins
0.037 looking for plugins in /home/stellarium/lib/python2.7/bzrlib/plugins
0.044 looking for plugins in /home/stellarium/lib/python2.7/site-packages/bzrlib/plugins
0.044 Plugin name netrc_credential_store already loaded
0.044 Plugin name news_merge already loaded
0.044 Plugin name bash_completion already loaded
0.044 Plugin name launchpad already loaded
0.045 encoding stdout as sys.stdout encoding 'UTF-8'
0.252 Traceback (most recent call last):
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 911, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 1111, in run_bzr
    ret = run(*run_argv)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 689, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/stellarium/lib/python2.7/bzrlib/commands.py", line 704, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/builtins.py", line 1321, in run
    branch_location)
  File "/home/stellarium/lib/python2.7/bzrlib/bzrdir.py", line 1032, in open_tree_or_branch
    bzrdir = klass.open(location)
  File "/home/stellarium/lib/python2.7/bzrlib/bzrdir.py", line 910, in open
    t = get_transport(base, possible_transports=possible_transports)
  File "/home/stellarium/lib/python2.7/bzrlib/lazy_import.py", line 125, in __call__
    return obj(*args, **kwargs)
  File "/home/stellarium/lib/python2.7/bzrlib/transport/__init__.py", line 1569, in get_transport
    base = directories.dereference(base)
  File "/home/stellarium/lib/python2.7/bzrlib/directory_service.py", line 58, in dereference
    return service().look_up(name, url)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_directory.py", line 59, in look_up
    return self._resolve(url)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_directory.py", line 69, in _resolve
    result = resolve.submit(service)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 272, in submit
    self._authenticated)
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 195, in send_request
    result = method(*method_params)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/home/stellarium/lib/python2.7/bzrlib/plugins/launchpad/lp_registration.py", line 78, in request
    return self.parse_response(response)
  File "/home/stellarium/lib/python2.7/xmlrpclib.py", line 1449, in parse_response
    if response.getheader("Content-Encoding", "") == "gzip":
AttributeError: addinfourl instance has no attribute 'getheader'

0.253 couldn't find apport bug-reporting library: No module named apport
0.261 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.261 return code 4

Related branches

lp:~toshio/bzr/python27-lp-fix
Merged into lp:bzr at revision 5439
Martin Pool: Approve on 2010-09-15
John A Meinel (jameinel) wrote :

Python 2.7 changed some of the expectations about what xmlrpclib needs from a custom transport implementation. We wrote a custom one because the built-in one doesn't support http proxies. However, we need to update it to now provide the extra facilities. (xmlrpclib now tries to support both Keep-Alive and Content-Encoding: gzip, though should that actually be Transfer-Encoding?)

summary: - exceptions.AttributeError: addinfourl instance has no attribute
- 'getheader'
+ XMLRPCTransport is incompatible with python 2.7
Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Martin Packman (gz) on 2010-08-06
tags: added: python2.7

Any progress on this? The upcoming Fedora-14 release is bitten by this.

Content-Encoding is probably right. No one uses Transfer-Encoding: gzip.

Toshio Kuratomi (toshio) wrote :

Here's a potential patch. I took the getheader and getheaders code from httplib.py and modified it to work with where the headers are stored in our addinfourl class. I've tested that I can branch with this bundle applied but nothing further.

>>>>> Toshio Kuratomi <email address hidden> writes:

    > Here's a potential patch. I took the getheader and getheaders code from
    > httplib.py and modified it to work with where the headers are stored in
    > our addinfourl class. I've tested that I can branch with this bundle
    > applied but nothing further.

    > ** Patch added: "bzr-python2.7-lp.patch"
    > https://bugs.launchpad.net/bzr/+bug/612096/+attachment/1526463/+files/bzr-python2.7-lp.patch

Could you make a merge proposal instead of attaching a patch ?
Pretty please ?

It's far easier for us to track and review.

+ return self.headers/getheader(name, default)

s#headers/getheader#headers.getheader# no ?

Toshio Kuratomi (toshio) wrote :

It's a bundle, can't you do something with it? I know how to generate patches because I have to do that constantly... generating branches on launchpad is something I have to relearn every time I do it.

/me goes to find the docs to do so again....

Toshio Kuratomi (toshio) wrote :

https://code.launchpad.net/~toshio/bzr/python27-lp-fix/+merge/35487

There doesn't seem to be any way to link the merge request to this bug in the interface atm... I thought there was on an earlier bug I filed but I don't see one now. :-(

Martin Pool (mbp) on 2010-09-15
Changed in bzr:
status: Confirmed → In Progress

Toshio: iirc linking of bugs is done using bzr commit --fixes lp:612096

Everyone: There is also a relevan upstream python bug report on this API change. http://psf.upfronthosting.co.za/roundup/tracker/issue8194

Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=622552

Vincent Ladeuil (vila) on 2010-09-21
Changed in bzr:
assignee: nobody → Toshio Kuratomi (toshio)
milestone: none → 2.3b2
status: In Progress → Fix Released
Changed in gentoo:
status: Unknown → Fix Released
Martin Packman (gz) on 2010-12-30
tags: added: python27
removed: python2.7
Changed in gentoo:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.