mirror of
https://github.com/gryf/slack-backup.git
synced 2025-12-17 03:20:25 +01:00
Added forgotten utils module
This commit is contained in:
21
slack_backup/utils.py
Normal file
21
slack_backup/utils.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
Some utils functions. Jsut to not copypaste the code around
|
||||
"""
|
||||
import errno
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
def makedirs(path):
|
||||
"""Create if not exists - version of os.makedirs."""
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as err:
|
||||
if err.errno != errno.EEXIST:
|
||||
logging.error("Cannot create `%s'.", path)
|
||||
raise
|
||||
else:
|
||||
if os.path.exists(path) and not os.path.isdir(path):
|
||||
logging.error("Cannot create `%s'. There is some file on the "
|
||||
"way; cannot proceed.", path)
|
||||
raise
|
||||
Reference in New Issue
Block a user