From 971754eba93701cfb22bc4399a37debf238eddf1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 12 May 2015 22:25:39 +0200 Subject: General fixup (1) --- pyload/config/Parser.py | 8 ++++++-- pyload/config/Setup.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'pyload/config') diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py index f834e4b4e..6e060ec9e 100644 --- a/pyload/config/Parser.py +++ b/pyload/config/Parser.py @@ -7,7 +7,7 @@ import shutil import time import traceback -from pyload.utils import chmod, encode, decode +from pyload.utils import encode, decode CONF_VERSION = 1 @@ -205,7 +205,11 @@ class ConfigParser(object): def saveConfig(self, config, filename): """saves config to filename""" with open(filename, "wb") as f: - os.chmod(filename, 0600) + try: + os.chmod(filename, 0600) + except Exception: + pass + f.write("version: %i \n" % CONF_VERSION) for section in config.iterkeys(): f.write('\n%s - "%s":\n' % (section, config[section]['desc'])) diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py index fdf2524f5..567be70f8 100644 --- a/pyload/config/Setup.py +++ b/pyload/config/Setup.py @@ -418,20 +418,20 @@ class SetupAssistant(object): def set_configdir(self, configdir, persistent=False): - dirname = path.abspath(configdir) + dirname = os.path.abspath(configdir) try: - if not path.exists(dirname): - os.makedirs(dirname, 0700) + if not os.path.exists(os.path.dirname): + os.makedirs(os.path.dirname, 0700) - os.chdir(dirname) + os.chdir(os.path.dirname) if persistent: - c = path.join(rootdir, "config", "configdir") - if not path.exists(c): + c = os.path.join(rootdir, "config", "configdir") + if not os.path.exists(c): os.makedirs(c, 0700) with open(c, "wb") as f: - f.write(dirname) + f.write(os.path.dirname) except IOError: return False @@ -478,7 +478,7 @@ class SetupAssistant(object): def check_prog(self, command): - pipe = PIPE + pipe = subprocess.PIPE try: subprocess.call(command, stdout=pipe, stderr=pipe) return True -- cgit v1.2.3