提交 7b3ea5a9 编写于 作者: A Alexandre Conrad

create log file's base directory if it doesn't exist

上级 3ae41632
......@@ -184,6 +184,9 @@ def open_logfile(filename, mode='a'):
the file to separate past activity from current activity.
"""
filename = os.path.expanduser(filename)
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
exists = os.path.exists(filename)
log_fp = open(filename, mode)
if exists:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册