python - How close and remove logfile in module logging? -


import logging, os   apppath = os.path.dirname(os.path.abspath(__file__))   def main():      pass  errorlogpath = apppath + '//myapperrorlog.log'  logging.basicconfig(     level=logging.debug,      filename = errorlogpath,     filemode='w+',     format= '%(asctime)s - %(levelname)s - %(message)s' )  try:     main()     os.remove(errorlogpath) #error except:     logging.exception("myapp:") 

file not removed on windows platform (unix normal), error - windowserror: [error 32] process can not access file.

how right close , remove file using module logging?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -