The output path was made absolute with os.path.abspath and '~' was expanded to the local home, so relative paths and '~' pointed to the wrong folder on the server. Resolve the path on the server instead, where '~' and relative paths refer to the remote user's home, and document it.