I have the following program
import os
import sys
import subprocess
from pathlib import Path
program = subprocess.check_output("which gphotos-sync", shell=True).decode().strip()
home = Path(os.path.expanduser("~")) / "photos"
args = [
"--ntfs",
"--retry-download",
"--skip-albums",
"--photos-path ".",
"--log-level", "DEBUG",
]
env = os.environ.copy()
env["LC_ALL"] = "en_US.UTF-8"
for p in home.glob("*/*"):
print([program, *args, str(p.relative_to(home))])
subprocess.run([program, *args, str(p.relative_to(home))], cwd=home, shell=True, env=env, stdout=sys.stdout, stderr=subprocess.STDOUT)
Which prints
['/home/ubuntu/.local/bin/gphotos-sync', '--ntfs', '--retry-download', '--skip-albums', '--photos-path .', '--log-level DEBUG', 'rodrigo/0']
usage: gphotos-sync [-h] [--album ALBUM] [--log-level LOG_LEVEL] [--logfile LOGFILE] [--compare-folder COMPARE_FOLDER] [--favourites-only] [--flush-index] [--rescan] [--retry-download]
[--skip-video] [--skip-shared-albums] [--album-date-by-first-photo] [--start-date START_DATE] [--end-date END_DATE] [--db-path DB_PATH] [--albums-path ALBUMS_PATH]
[--photos-path PHOTOS_PATH] [--use-flat-path] [--omit-album-date] [--new-token] [--index-only] [--skip-index] [--do-delete] [--skip-files] [--skip-albums] [--use-hardlinks]
[--no-album-index] [--case-insensitive-fs] [--max-retries MAX_RETRIES] [--max-threads MAX_THREADS] [--secret SECRET] [--archived] [--progress] [--max-filename MAX_FILENAME]
[--ntfs]
root_folder
As you can see, gphotos-sync
requires the root_folder
(the last argument). But if I run the printed command line manually, the program works fine
/home/ubuntu/.local/bin/gphotos-sync --ntfs --retry-download --skip-albums --photos-path . --log-level DEBUG rodrigo/0
Am I missing something?