Browse Source

修复路径错误

liuyuqi-dellpc 6 months ago
parent
commit
a9115896c6
1 changed files with 4 additions and 2 deletions
  1. 4 2
      main.py

+ 4 - 2
main.py

@@ -7,10 +7,12 @@
 @Desc    :   enter point
 '''
 from set_github_secret import GithubApi
-import json,os
+import json,os,sys
 
 if __name__=='__main__':
-    current_run_path = os.path.dirname(os.path.realpath(__file__))
+    
+    # current_run_path = os.path.dirname(os.path.realpath(__file__))   错误: windows exe 定位到 temp目录
+    current_run_path = sys.path[0]
     with open(os.path.join(current_run_path,"account.json"), "r") as file:
         data = json.load(file)
         owner=data["owner"]