From f974cdf4094d5048a3ce7de6e4d6ff3799248da2 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 8 Nov 2015 05:09:06 -0600 Subject: [PATCH] Make config directory if it doesn't already exist (#63) --- docs/installation.rst | 2 +- earwigbot/config/script.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index a594623..7c0d0a6 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -54,5 +54,5 @@ features (``feature/*`` branches):: .. _earwigbot-plugins: https://github.com/earwig/earwigbot-plugins .. _Python Package Index: http://pypi.python.org .. _get pip: http://pypi.python.org/pypi/pip -.. _this StackOverflow post: http://stackoverflow.com/questions/6504810/how-to-install-lxml-on-ubuntu/6504860#6504860 +.. _this StackOverflow post: http://stackoverflow.com/questions/6504810/how-to-install-lxml-on-ubuntu/6504860#6504860 .. _git flow: http://nvie.com/posts/a-successful-git-branching-model/ diff --git a/earwigbot/config/script.py b/earwigbot/config/script.py index c1ffef4..e6e4ec8 100644 --- a/earwigbot/config/script.py +++ b/earwigbot/config/script.py @@ -23,7 +23,7 @@ from collections import OrderedDict from getpass import getpass from hashlib import sha256 -from os import chmod, mkdir, path +from os import chmod, makedirs, mkdir, path import re import stat import sys @@ -441,6 +441,7 @@ class ConfigScript(object): def make_new(self): """Make a new config file based on the user's input.""" try: + makedirs(path.dirname(self.config.path)) open(self.config.path, "w").close() chmod(self.config.path, stat.S_IRUSR|stat.S_IWUSR) except IOError: