docker-archive / python-dockercloud

Python library for Docker Cloud
https://cloud.docker.com/
Apache License 2.0
28 stars 30 forks source link

python3 support #7

Open Bekt opened 8 years ago

Bekt commented 8 years ago

The library doesn't seem to work with python3. A lot of people have moved away from python2, so it'd be nice to add support for python3 to take advantage of the library.

Python 3.5.1 (default, Dec 26 2015, 18:11:22)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import dockercloud
>>>
>>> dockercloud.Action.list()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv3/lib/python3.5/site-packages/dockercloud/api/base.py", line 149, in list
    json = send_request('GET', detail_uri, params=kwargs)
  File ".../venv3/lib/python3.5/site-packages/dockercloud/api/http.py", line 37, in send_request
    url = urljoin(dockercloud.rest_host.rstrip("/"), path.strip("/").encode("ascii", "ignore"))
  File ".../python3.5/urllib/parse.py", line 415, in urljoin
    base, url, _coerce_result = _coerce_args(base, url)
  File ".../python3.5/urllib/parse.py", line 111, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments

I've tested the same code with python 2.7.10, and it works just fine.

Midnighter commented 7 years ago

Same experience for me, I put it in a forum post. Issue occurs with environment variables as well as with setting the relevant attributes.

penkin commented 7 years ago

Any fix or work around for this?

Midnighter commented 7 years ago

There are some open pull requests that look promising...

penkin commented 7 years ago

@Midnighter Also added a PR now as well #29. Tests pass in both Python2 and 3. Will see if it gets accepted. Tried to rebase my commits so it looked a little cleaner but could not it seems.

brgirgis commented 6 years ago

Any update about this issue? Please let me know how I could help to accelerate any advancement toward a solution.

mbdevpl commented 6 years ago

I second this! PR #29 seems good.

My suggested workaround for the impatient:

pip3 install git+https://github.com/penkin/python-dockercloud

This will install the py3-compatible version.

mbdevpl commented 6 years ago

Oops, just noticed that this whole thing is deprecated...