Răsfoiți Sursa

Update LogHandler.py

Traceback (most recent call last):
  File "proxyPool.py", line 21, in <module>
    from Config.setting import HEADER
  File "../Config/setting.py", line 94, in <module>
    checkConfig()
  File "../Config/setting.py", line 88, in checkConfig
    from ProxyGetter import getFreeProxy
  File "../ProxyGetter/getFreeProxy.py", line 21, in <module>
    from Util.WebRequest import WebRequest
  File "../Util/__init__.py", line 15, in <module>
    from Util.LogHandler import LogHandler
  File "../Util/LogHandler.py", line 37, in <module>
    os.mkdir(LOG_PATH)
FileExistsError: [Errno 17] File exists: '/usr/src/app/Util/../log'

****************************************************************
*** ______  ********************* ______ *********** _  ********
*** | ___ \_ ******************** | ___ \ ********* | | ********
*** | |_/ / \__ __   __  _ __   _ | |_/ /___ * ___  | | ********
*** |  __/|  _// _ \ \ \/ /| | | ||  __// _ \ / _ \ | | ********
*** | |   | | | (_) | >  < \ |_| || |  | (_) | (_) || |___  ****
*** \_|   |_|  \___/ /_/\_\ \__  |\_|   \___/ \___/ \_____/ ****
****                       __ / /                          *****
************************* /___ / *******************************
*************************       ********************************
****************************************************************
Todd Tao 6 ani în urmă
părinte
comite
b0f069e9a5
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      Util/LogHandler.py

+ 3 - 1
Util/LogHandler.py

@@ -33,8 +33,10 @@ CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
 ROOT_PATH = os.path.join(CURRENT_PATH, os.pardir)
 LOG_PATH = os.path.join(ROOT_PATH, 'log')
 
-if not os.path.exists(LOG_PATH):
+try:
     os.mkdir(LOG_PATH)
+except FileExistsError:
+    pass
 
 
 class LogHandler(logging.Logger):