我正在学习使用Python / Selenium进行编码。
我实现了我想做的第一件事,但是我遇到了一个Windows批处理中的脚本问题,该脚本可以在一台PC上正常运行,但不能在另一台PC上正常运行,尽管我读了很多书,但我仍然不明白为什么!
我创建了一个与设置文件配合使用的脚本。
我尝试用这段代码来检索它:
with open(str(sys.argv[1]), "r") as settings:
然后按如下所示在.cmd文件中批量调用该脚本:
start "py" "script.py" "script1.txt"
start "py" "script.py" "script2.txt"
在第一台计算机上,一切正常,该脚本已正确启动两次,每次使用正确的设置文件启动。
在另一台计算机上:
DevTools listening on ws://127.0.0.1:52471/devtools/browser/f0cc9389-d887-4d48-ab52-87d10f867d5a
Traceback (most recent call last):
File "C:\Users\Jeremie\Dropbox\perso\TIX\script.py", line 19, in <module>
with open(str(sys.argv[1]), "r") as settings:
IndexError: list index out of range
怎么可能?
这两台计算机都在Windows 10上。