Update UNIX-like system user profile picture with its GitHub account's one Seeking to learning and have fun, I wrote out this script (what I expected to be) self explanatory and would appreciate some comments on that.
I published it as a gist and tried to do my best on what I understand about object-orientation, documentation, code readability and python best practices, so to speak. The idea was practice and learn!
Any review in these or other concepts that could turn this result in a better solution is very welcome!
#!/usr/bin/python3
&quot;&quot;&quot;Update UNIX-like system user profile picture with its GitHub account's one

This script assumes same system and platform username, but a different one can be declared.
It downloads target GitHub account's picture and set it up to current system user
&quot;&quot;&quot;

import os
import requests
import configparser
import click

# Get system's logged username
USER = os.getlogin()


def save_github_picture(username, path):
    &quot;&quot;&quot;Gets GitHub user account's profile picture and saves it into target path

    :param username: GitHub account username
    :param path: Picture's path destination
    &quot;&quot;&quot;

    with open(path, &quot;wb&quot;) as picture:
        gh_profile_picture = requests.get(f&quot;https://github.com/{username}.png&quot;).content
        picture.write(gh_profile_picture)


def set_user_profile_picture(path):
    &quot;&quot;&quot;Edits logged user AccountsService file to setup its profile picture path

    :param path: New profile picture path
    &quot;&quot;&quot;

    # UNIX-like system user settings file
    accounts_service_path = f&quot;/var/lib/AccountsService/users/{USER}&quot;

    cfg = configparser.ConfigParser()
    cfg.read(accounts_service_path)
    cfg['User']['Icon'] = path

    with open(accounts_service_path, 'w') as accounts_service:
        cfg.write(accounts_service)


@click.command()
@click.argument('github_username', default=USER)
@click.option('--path', default=f&quot;/home/{USER}/.face&quot;, help='define picture target path.')
def run(github_username, path):
    &quot;&quot;&quot;Command line interface to define script's arguments

    :param github_username: GitHub account username (default: system user)
    :param path: New profile picture path (default: ~/.face)
    &quot;&quot;&quot;
    try:
        save_github_picture(github_username, path)
        set_user_profile_picture(path)
    except Exception:
        raise
    else:
        print(f&quot;User profile picture updated with {github_username}'s GitHub one&quot;)


if __name__ == '__main__':
    if os.geteuid() != 0:
        raise PermissionError(&quot;This action requires root privileges&quot;)
    else:
        run()
try:
    ...
except Exception:
    raise
else:
    ...

You're not doing anything with the captured exception, so this accomplish nothing more than the code in .... You can drop the try, the code in the else will never execute if there is an exception in the previous two functions anyway.
Depending on the size of the downloaded images, you may also consider streaming the http response to a file directly instead of using the memory as a buffer.