aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2011-03-25 19:58:57 +0100
committerAndreas Oberritter <obi@opendreambox.org>2011-03-29 15:43:58 +0200
commit2c5e4d6c412c1988b32cb7dbede988bc9dfb815d (patch)
treebee1e985d0b73ccd4ac6f541110bb9fea96969bf /lib/python
parent7f070068aa203cb95252b641b1c0cc5308a604ee (diff)
downloadenigma2-2c5e4d6c412c1988b32cb7dbede988bc9dfb815d.tar.gz
enigma2-2c5e4d6c412c1988b32cb7dbede988bc9dfb815d.zip
fix some crashes during settings wizard
Diffstat (limited to 'lib/python')
-rwxr-xr-xlib/python/Components/config.py9
-rw-r--r--lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py10
-rw-r--r--lib/python/Screens/DefaultWizard.py3
-rwxr-xr-xlib/python/Tools/Directories.py17
4 files changed, 25 insertions, 14 deletions
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index 6e560857..5507cae9 100755
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -1661,9 +1661,12 @@ class Config(ConfigSubsection):
def saveToFile(self, filename):
text = self.pickle()
- f = open(filename, "w")
- f.write(text)
- f.close()
+ try:
+ f = open(filename, "w")
+ f.write(text)
+ f.close()
+ except IOError:
+ print "Config: Couldn't write %s" % filename
def loadFromFile(self, filename, base_file=False):
f = open(filename, "r")
diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
index dc4e8c56..6ecbfd49 100644
--- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
+++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
@@ -196,10 +196,12 @@ class VideoHardware:
print "saveMode", port, mode, rate
config.av.videoport.value = port
config.av.videoport.save()
- config.av.videomode[port].value = mode
- config.av.videomode[port].save()
- config.av.videorate[mode].value = rate
- config.av.videorate[mode].save()
+ if port in config.av.videomode:
+ config.av.videomode[port].value = mode
+ config.av.videomode[port].save()
+ if mode in config.av.videorate:
+ config.av.videorate[mode].value = rate
+ config.av.videorate[mode].save()
def isPortAvailable(self, port):
# fixme
diff --git a/lib/python/Screens/DefaultWizard.py b/lib/python/Screens/DefaultWizard.py
index 73b07acf..54e241de 100644
--- a/lib/python/Screens/DefaultWizard.py
+++ b/lib/python/Screens/DefaultWizard.py
@@ -25,9 +25,10 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler):
self["arrowup2"] = MovingPixmap()
def setDirectory(self):
- os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)
self.xmlfile = "defaultwizard.xml"
+ if self.directory:
+ os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), self.directory))
def markDone(self):
config.misc.defaultchosen.value = 0
diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py
index 8e4d0044..f0ef0de2 100755
--- a/lib/python/Tools/Directories.py
+++ b/lib/python/Tools/Directories.py
@@ -118,7 +118,11 @@ def resolveFilename(scope, base = "", path_prefix = None):
if flags == PATH_CREATE:
if not pathExists(path):
- mkdir(path)
+ try:
+ mkdir(path)
+ except OSError:
+ print "resolveFilename: Couldn't create %s" % path
+ return None
fallbackPath = fallbackPaths.get(scope)
@@ -224,12 +228,13 @@ def InitFallbackFiles():
# returns a list of tuples containing pathname and filename matching the given pattern
# example-pattern: match all txt-files: ".*\.txt$"
def crawlDirectory(directory, pattern):
- expression = compile(pattern)
list = []
- for root, dirs, files in walk(directory):
- for file in files:
- if expression.match(file) is not None:
- list.append((root, file))
+ if directory:
+ expression = compile(pattern)
+ for root, dirs, files in walk(directory):
+ for file in files:
+ if expression.match(file) is not None:
+ list.append((root, file))
return list
def copyfile(src, dst):