ver 2022-09-13, due to python 2.x not work, change the execute script order

master
CHUN YU YAO 2022-09-13 21:29:18 +08:00
parent ad33e34891
commit 89d1c2e1fc
3 changed files with 13 additions and 5 deletions

View File

@ -33,9 +33,9 @@ the default path is the script path + "webdriver/chromedriver", My suggestion is
PS:
* this script only running in python3. (原始碼只可以在 python3 下執行。)
* 請先確定你的python 執行環境下已安裝 selenium 及 selenium-stealth 或相關的套件,請參考 pip-reg.txt 檔案內容。
* 請到ChromeDriver網站 (https://chromedriver.chromium.org/) 下載與您目前相同版本的 ChromeDriver 的執行檔放在搶票程式的webdriver目錄下(Mac電腦請放到 MaxBot.app 套件裡的 /Contents/Resources/webdriver/),在執行搶票程式前,第一次執行搶票主程式前,前請先手動點 ChromeDriver 的執行檔。
* 最後透過 python3 執行 settings.py 就可以有 GUI 的設定界面。)
* 請先確定你的python 執行環境下已安裝 selenium 及相關的套件,請參考 pip-reg.txt 檔案內容。
* 如果是 2022-09-13 之前的版本,請到ChromeDriver網站 (https://chromedriver.chromium.org/) 下載與您目前相同版本的 ChromeDriver 的執行檔放在搶票程式的webdriver目錄下(Mac電腦請放到 MaxBot.app 套件裡的 /Contents/Resources/webdriver/),在執行搶票程式前,第一次執行搶票主程式前,前請先手動點 ChromeDriver 的執行檔。
* 透過 python3 執行 settings.py 就可以有 GUI 的設定界面。
* 如果你是使用 macOS 並且執行環境沒有 python3請 python 官方網站(https://www.python.org/downloads/)來安裝 python3, 如果在 macOS 裡會使用終端機(Terminal),建議使用 https://brew.sh/ 安裝 python3.
* 如果你是使用 Firefox, ChromeDriver 的元件是叫 geckodriver下載點在https://github.com/mozilla/geckodriver/releases ,與 ChromeDriver 的處理方式是一樣,如果是 mac 電腦要在元件按右鍵開啟做一次授權的動作mac 有2個版本-macos.tar.gz 與 -macos-aarch64.tar.gz ,如果是 intel CPU 的版本,請服用前面沒有 aarch64 的版本。

View File

@ -7,6 +7,9 @@ import json
import random
#print("python version", platform.python_version())
# seleniumwire not support python 2.x.
# if you want running under python 2.x, you need to assign driver_type = 'stealth'
#driver_type = 'selenium'
driver_type = 'stealth'
driver_type = 'undetected_chromedriver'

View File

@ -153,15 +153,15 @@ def btn_save_act(slience_mode=False):
return is_all_data_correct
def btn_run_clicked():
import subprocess
print('run button pressed.')
Root_Dir = ""
save_ret = btn_save_act(slience_mode=True)
print("save config result:", save_ret)
if save_ret:
import subprocess
if hasattr(sys, 'frozen'):
print("execute in frozen mode")
import platform
# check platform here.
if platform.system() == 'Darwin':
@ -177,6 +177,11 @@ def btn_run_clicked():
interpreter_binary = 'python'
interpreter_binary_alt = 'python3'
if platform.system() == 'Darwin':
# try python3 before python.
interpreter_binary = 'python3'
interpreter_binary_alt = 'python'
print("execute in shell mode.")
working_dir = os.path.dirname(os.path.realpath(__file__))
#print("script path:", working_dir)