Ignore problems with writing data to user's directory.

This commit is contained in:
Lukáš Lalinský
2007-01-21 11:12:35 +01:00
parent b40dc00728
commit 2715092bd0
2 changed files with 12 additions and 8 deletions

View File

@@ -104,7 +104,10 @@ class Tagger(QtGui.QApplication, ComponentManager, Component):
self.logdir = os.path.join(self.user_dir, "logs")
if not os.path.isdir(self.logdir):
os.makedirs(self.logdir)
try:
os.makedirs(self.logdir)
except EnvironmentError:
pass
self.setup_logging()
self.log.debug("Starting Picard %s from %s", picard.__version__,
@@ -158,10 +161,12 @@ class Tagger(QtGui.QApplication, ComponentManager, Component):
console = logging.StreamHandler(sys.stdout)
console.setFormatter(formatter)
self.log.addHandler(console)
logfile = logging.FileHandler(
os.path.join(self.logdir, time.strftime('%Y-%m-%d.log')))
logfile.setFormatter(formatter)
self.log.addHandler(logfile)
try:
logfile = logging.FileHandler(os.path.join(self.logdir, time.strftime('%Y-%m-%d.log')))
logfile.setFormatter(formatter)
self.log.addHandler(logfile)
except EnvironmentError:
pass
def move_files_to_album(self, files, albumid=None, album=None):
"""Move `files` to tracks on album `albumid`."""

View File

@@ -35,9 +35,8 @@ class CachedWebService(WebService):
if not os.path.isdir(self._cache_dir):
try:
os.makedirs(self._cache_dir)
except IOError:
self._log.error('Couldn\'t create cache directory %s',
self._cache_dir)
except EnvironmentError:
self._log.error("Couldn't create cache directory %s", self._cache_dir)
def get(self, entity, id_, include=(), filter={}, version='1'):
"""Query the web service."""