New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create event DB dir if non-extant. #55

Merged
merged 4 commits into from Jan 15, 2018

Conversation

Projects
None yet
2 participants
@jdswinbank
Owner

jdswinbank commented Jan 13, 2018

No description provided.

@jdswinbank jdswinbank force-pushed the create_eventdb branch from 1599f05 to a426088 Jan 13, 2018

@@ -22,6 +22,8 @@

class Event_DB(object):
def __init__(self, root):
if not os.path.exists(root):
os.makedirs(root)

This comment has been minimized.

@timstaley

timstaley Jan 14, 2018

Contributor

What if root exists, but points at a file?

How about...

def ensure_dir(dirname):
    """Ensure directory exists, or raise exception if file of same name exists."""
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    elif not os.path.isdir(dirname):
        raise RuntimeError("Path exists but is not directory: \n" + dirname)

This comment has been minimized.

@jdswinbank

jdswinbank Jan 14, 2018

Owner

Good idea!

jdswinbank added some commits Jan 14, 2018

Use longer timestamps in test filenames.
Being specific about this avoids name clashes on Python 2.

@jdswinbank jdswinbank merged commit 0787cbc into master Jan 15, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment