From d61a9ad4d55c1db04bc6aed101eeb99d7c2c0aed Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 9 Apr 2010 17:31:47 +0200 Subject: [PATCH] create ~/.weboob/backends with right permssions if it does not exist. --- weboob/modules.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/weboob/modules.py b/weboob/modules.py index 16784126..85ee674a 100644 --- a/weboob/modules.py +++ b/weboob/modules.py @@ -81,10 +81,14 @@ class BackendsConfig: def __init__(self, confpath): self.confpath = confpath - mode = os.stat(confpath).st_mode - if mode & stat.S_IRGRP or mode & stat.S_IROTH: - raise self.WrongPermissions( - u'Weboob will not start until config file %s is readable by group or other users.' % confpath) + try: + mode = os.stat(confpath).st_mode + except OSError: + os.mknod(confpath, 0600) + else: + if mode & stat.S_IRGRP or mode & stat.S_IROTH: + raise self.WrongPermissions( + u'Weboob will not start until config file %s is readable by group or other users.' % confpath) def iter_backends(self): config = SafeConfigParser()