[Python] Symlink to point at correct database

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm writing a script to point at a specific database with a symlink and I'm not sure how to handle existing symlinks.

    I tried the code below, but I am not sure if it works.

    if os.path.exists(symlink_path):
    if not os.path.islink(symlink_path):
    exit_with_error("db.sqlite exists and is not a symlink")

    print("Checking existence of symlink... done")
    os.remove(symlink_path)

    Continue reading...

Compartilhe esta Página