-
-
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?
Conversation
Adding check for log file/log directory existence - Had to manually create the location when installed on OSX
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.
A couple of changes there mate. I'd suggest deleting the log file/dir locally and running your branch just to make sure it's doing what you want it to do
with open('sample.csv', 'w') as creating_new_log_file: | ||
pass | ||
|
||
logging.basicConfig(filename, filemode='w', |
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.
logging.basicConfig
doesn't take any position args. If you look at the original code (or just check the function signature) you'll see it expects filename as a keyword arg. I'd suggest running your code at least once just to sanity check this kind of thing
|
||
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
sample.csv
?
try: | ||
os.makedirs(os.path.dirname(filename)) | ||
except OSError as exc: # prevent race condition | ||
if exc.errno != errno.EEXIST: |
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
Adding check for log file/log directory existence - Had to manually create the location when installed on OSX