Skip to content

AttributeError: module 'urllib' has no attribute 'urlencode' (Python 3, repository_blob) #271

@mdhausman

Description

@mdhausman

Getting an issue in python 3.6 with the project.repository_blob function.

File "[blah blah blah]/lib/python3.6/site-packages/gitlab/v3/objects.py", line 1885, in repository_blob
    url += '?%s' % (urllib.urlencode({'filepath': filepath}))
AttributeError: module 'urllib' has no attribute 'urlencode'

urlencode was moved in py3 to urllib.parse.urlencode (https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode). For maintaining compatibility across python 2 and 3, consider six's six.moves.urllib instead of urllib itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions