[Bug 1425609] [NEW] urllib.urlencode() does not exist for python3

Martin Pitt martin.pitt at ubuntu.com
Wed Feb 25 17:28:55 UTC 2015


Public bug reported:

This is similar to bug 1414055, but now for urlencode:

Traceback (most recent call last):
  File "apport/crashdb_impl/launchpad.py", line 1950, in test_marking_python_task_mangle
    t = b.bug_tasks[0]
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 853, in __getitem__
    found_slice = self._get_slice(slice(key, key + 1))
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 903, in _get_slice
    self._wadl_resource.url, 'ws.start', start)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 976, in _with_url_query_variable_set
    uri.query = urllib.urlencode(params, True)
AttributeError: 'module' object has no attribute 'urlencode'


I suggest something like

if sys.version_info.major == 2:
    from urllib import urlencode
else:
    from urllib.parse import urlencode

and use urlencode() without namespace.

** Affects: lazr.restfulclient (Ubuntu)
     Importance: Undecided
     Assignee: Dimitri John Ledkov (xnox)
         Status: New

** Changed in: lazr.restfulclient (Ubuntu)
     Assignee: (unassigned) => Dimitri John Ledkov (xnox)

-- 
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/1425609

Title:
  urllib.urlencode() does not exist for python3

Status in lazr.restfulclient package in Ubuntu:
  New

Bug description:
  This is similar to bug 1414055, but now for urlencode:

  Traceback (most recent call last):
    File "apport/crashdb_impl/launchpad.py", line 1950, in test_marking_python_task_mangle
      t = b.bug_tasks[0]
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 853, in __getitem__
      found_slice = self._get_slice(slice(key, key + 1))
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 903, in _get_slice
      self._wadl_resource.url, 'ws.start', start)
    File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 976, in _with_url_query_variable_set
      uri.query = urllib.urlencode(params, True)
  AttributeError: 'module' object has no attribute 'urlencode'

  
  I suggest something like

  if sys.version_info.major == 2:
      from urllib import urlencode
  else:
      from urllib.parse import urlencode

  and use urlencode() without namespace.

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



More information about the foundations-bugs mailing list