From d34f7af05e95bdd8857aab7c6bf62f4c937a85fe Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 14 Feb 2019 10:43:49 +0000 Subject: Bugfix for directory creation rMapi was failing when the target directory had a trailing "/", so we always strip that now. --- arxiv2remarkable.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'arxiv2remarkable.py') diff --git a/arxiv2remarkable.py b/arxiv2remarkable.py index b09bace..2f7ffe1 100755 --- a/arxiv2remarkable.py +++ b/arxiv2remarkable.py @@ -214,15 +214,18 @@ def generate_filename(info): def upload_to_rm(filepath, remarkable_dir="/", rmapi_path="rmapi"): + remarkable_dir = remarkable_dir.rstrip("/") logger.info("Starting upload to reMarkable") - if not remarkable_dir == "/": - status = subprocess.call([rmapi_path, "mkdir", remarkable_dir]) + if remarkable_dir: + status = subprocess.call( + [rmapi_path, "mkdir", remarkable_dir], stdout=subprocess.DEVNULL + ) if not status == 0: exception( "Creating directory %s on reMarkable failed" % remarkable_dir ) status = subprocess.call( - [rmapi_path, "put", filepath, remarkable_dir], + [rmapi_path, "put", filepath, remarkable_dir + "/"], stdout=subprocess.DEVNULL, ) if not status == 0: -- cgit v1.2.3