Why can’t I sort a list of dicts in 3.x? Why do I get “TypeError: ‘

Python 2’s dictionary sort order was quite involved and poorly understood. It only happened to work because Python 2 tried to make everything orderable. For your specific case, with {‘name’: …} dictionaries with a single key, the ordering was determined by the value for that single key. In Python 3, where dictionaries are no longer … Read more

How to see progress of Dask compute task?

If you’re using the single machine scheduler then do this: from dask.diagnostics import ProgressBar ProgressBar().register() http://dask.pydata.org/en/latest/diagnostics-local.html If you’re using the distributed scheduler then do this: from dask.distributed import progress result = df.id.count.persist() progress(result) Or just use the dashboard http://dask.pydata.org/en/latest/diagnostics-distributed.html

Ansible create a virtualenv using the venv module

I ran into the same issue tonight and found that specifying the full path to the interpreter, including the arguments, worked for me (at least it does in ansible==2.2.2.0): – pip: requirements: /website/requirements.txt virtualenv: /opt/website-venv virtualenv_command: /usr/bin/python3.6 -m venv or – pip: requirements: /opt/project/requirements_prod.txt virtualenv: /opt/.virtualenv/project_env virtualenv_python: python3

Python bytes concatenation

If you want to change your byte sequence, you should use a bytearray. It is mutable and has the .append method: >>> a = bytearray(b’\x14\xf6′) >>> a.append(a[0]) >>> a bytearray(b’\x14\xf6\x14′) What happens in your approach: when you do a += a[0] you are trying to add an integer to a bytes object. That doesn’t make … Read more

How to default Python3.8 on my Mac using Homebrew?

Here is the solution: If existing symlinks belong to python 3.7 you should unlink them: brew unlink python Basically all you need to do: brew link –force [email protected] OR force the link and overwrite all conflicting files: brew link –force –overwrite [email protected] OR if needed list all files that would be deleted: brew link –overwrite … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)