Browse Source

定时任务添加当前路径

liyuyi@c-top.com.cn 3 years ago
parent
commit
3908a8d820
1 changed files with 8 additions and 0 deletions
  1. 8 0
      time_task/get_word2vec_model.py

+ 8 - 0
time_task/get_word2vec_model.py

@@ -1,8 +1,16 @@
+import sys
+
+import os
+
 import pandas as pd
 import pandas as pd
 from gensim.models import KeyedVectors
 from gensim.models import KeyedVectors
 from gensim.models import Word2Vec
 from gensim.models import Word2Vec
 from loguru import logger
 from loguru import logger
 
 
+curr_path = os.path.abspath(os.path.dirname(__file__))
+project_root_path = curr_path[:curr_path.find("video_to_word") + len("video_to_word")]
+sys.path.append(project_root_path)
+
 from config.url_and_db import ai_word_product_engine
 from config.url_and_db import ai_word_product_engine
 
 
 logger.remove()  # 删去 import logger之后自动产生的handler,不删除的话会出现重复输出的现象
 logger.remove()  # 删去 import logger之后自动产生的handler,不删除的话会出现重复输出的现象