-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Adding check for log file/log directory existence #35
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,18 @@ | |
import os | ||
|
||
user_config_dir = os.path.expanduser("~") | ||
logging.basicConfig(filename=user_config_dir + '/.cache/spotui.log', filemode='w', | ||
filename = user_config_dir + "/.cache/spotui.log" | ||
if not os.path.exists(os.path.dirname(filename)): | ||
try: | ||
os.makedirs(os.path.dirname(filename)) | ||
except OSError as exc: # prevent race condition | ||
if exc.errno != errno.EEXIST: | ||
raise | ||
|
||
# if log file doesn't exist | ||
if not os.path.isfile(filename): | ||
with open('sample.csv', 'w') as creating_new_log_file: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
pass | ||
|
||
logging.basicConfig(filename, filemode='w', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
format='%(name)s - %(levelname)s - %(message)s') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't import
errno