[FIX] Check if dirname is empty or not

lp bug: https://launchpad.net/bugs/301983 fixed

bzr revid: stephane@tinyerp.com-20081212002815-hcc325x6gjp66lpg
This commit is contained in:
Stephane Wirtel 2008-12-12 01:28:15 +01:00
parent cbf2dee7c7
commit 38df72d010
1 changed files with 3 additions and 4 deletions

View File

@ -157,13 +157,12 @@ def init_logger():
if config['logfile']:
logf = config['logfile']
# test if the directories exist, else create them
try:
dirname = os.path.dirname(logf)
if not os.path.isdir(dirname):
res = os.makedirs(dirname)
if dirname and not os.path.isdir(dirname):
os.makedirs(dirname)
handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30)
except:
except Exception, ex:
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
handler = logging.StreamHandler(sys.stdout)
else: