From e55e123f546ac2455bcd7c27a1f259a57d4cb976 Mon Sep 17 00:00:00 2001 From: S J Saravanan Date: Mon, 15 Jul 2013 15:03:46 +0530 Subject: [PATCH] Fixed string parsing logic Fixed this error which used to come up previously :- Traceback (most recent call last): File "github-backup.py", line 55, in main() File "github-backup.py", line 22, in main process_repo(repo, args) File "github-backup.py", line 45, in process_repo print("Processing repo: {}".format(repo.full_name)) ValueError: zero length field name in format --- github-backup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/github-backup.py b/github-backup.py index 53a9c87..2b36a6d 100755 --- a/github-backup.py +++ b/github-backup.py @@ -42,14 +42,14 @@ def process_repo(repo, args): git_args = "" if not args.cron: - print("Processing repo: {}".format(repo.full_name)) + print("Processing repo: %s"%(repo.full_name)) - if os.access('{}/{}/.git'.format(args.backupdir,repo.name),os.F_OK): + if os.access('%s/%s/.git'%(args.backupdir,repo.name),os.F_OK): if not args.cron: print("Repo already exists, let's try to update it instead") - os.system('cd {}/{};git pull {}'.format(args.backupdir, repo.name, git_args)) + os.system('cd %s/%s;git pull %s'%(args.backupdir, repo.name, git_args)) else: # Repo doesn't exist, let's clone it - os.system('git clone {} {} {}/{}'.format(git_args, repo.git_url, args.backupdir, repo.name)) + os.system('git clone %s %s %s/%s'%(git_args, repo.git_url, args.backupdir, repo.name)) if __name__ == "__main__": main()