【发布时间】:2021-04-09 03:42:52
【问题描述】:
我的 webdriver-manager 运行良好,但是当我使用 pyinstaller 创建 .exe 文件时,出现以下错误。我发现如果我不将 --noconsole 放到 pyinstaller 命令中,它会起作用,但是使用 --noconsole 程序不起作用。 这是我的代码:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.google.com/")
driver.quit()
这是我使用 pyinstaller 创建 .exe 文件的方式:
pyinstaller --onefile --noconsole script.py
这是我得到的错误:
Traceback (most recent call last):
File "script.py", line 797, in program2
File "webdriver_manager\chrome.py", line 23, in __init__
File "webdriver_manager\driver.py", line 54, in __init__
File "webdriver_manager\utils.py", line 139, in chrome_version
File "os.py", line 983, in popen
File "subprocess.py", line 804, in __init__
File "subprocess.py", line 1142, in _get_handles
OSError: [WinError 6] The handle is invalid
感谢您的帮助!
【问题讨论】:
-
应该在昨天发布的 webdriver-manager 3.5.0 中修复
标签: python selenium webdriver pyinstaller webdriver-manager