diff options
author | 2015-05-12 22:25:39 +0200 | |
---|---|---|
committer | 2015-05-12 22:25:39 +0200 | |
commit | 971754eba93701cfb22bc4399a37debf238eddf1 (patch) | |
tree | e3a36023f93b73a1621de0c6c9503ccbb301fb03 /pyload/config | |
parent | Fix dict generators for python 2.5 (diff) | |
download | pyload-971754eba93701cfb22bc4399a37debf238eddf1.tar.xz |
General fixup (1)
Diffstat (limited to 'pyload/config')
-rw-r--r-- | pyload/config/Parser.py | 8 | ||||
-rw-r--r-- | pyload/config/Setup.py | 16 |
2 files changed, 14 insertions, 10 deletions
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 |