[Bug 1414075] Re: [py3] bug.lp_save() crashes with TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Dimitri John Ledkov launchpad at surgut.co.uk
Sat Jan 31 13:26:48 UTC 2015


** Changed in: lazr.restfulclient (Ubuntu)
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to lazr.restfulclient in Ubuntu.
https://bugs.launchpad.net/bugs/1414075

Title:
  [py3] bug.lp_save() crashes with TypeError: startswith first arg must
  be bytes or a tuple of bytes, not str

Status in lazr.restfulclient package in Ubuntu:
  Fix Committed

Bug description:
  While porting Apport to python3-launchpadlib, I stumbled over the
  inability to call lp_save() on a bug object:

  $ python3 /tmp/test.py
  Traceback (most recent call last):
    File "/tmp/test.py", line 10, in <module>
      bug.lp_save()
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 778, in lp_save
      URI(self.self_link), representation, headers)
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 475, in patch
      cached_etag = self._connection._getCachedHeader(str(url), 'etag')
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 188, in _getCachedHeader
      return self.cache._getCachedHeader(uri, header)
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 323, in _getCachedHeader
      if line.startswith(header_start):
  TypeError: startswith first arg must be bytes or a tuple of bytes, not str

  When I call the same with python 2, it works fine. Note that this is a
  write operation, so this needs to use login_with() and credentials. So
  you might want to change the credentials_file= argument in the
  reproducer or drop it completely (then you'll have to log in every
  time you run the reproducer).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lazr.restfulclient/+bug/1414075/+subscriptions



More information about the foundations-bugs mailing list