因此,当我尝试打开.bat文件时:
Traceback (most recent call last):
File "accorddownload.py", line 31, in <module>
subprocess.run(["Tools\aAIvwb.bat"], creationflags=0x08000000)
File "C:\Program Files\Python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Program Files\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
我正在使用它运行
subprocess.run(["tools\aAIvwb.bat"], creationflags=0x08000000)
但是问题是我检查了该位置20次并继续尝试修复,但是同一件事正在发生。这是文件结构
AB
|
|--Tools--|
| |--aaitp.bat
| |--aAIvwb.bat
| |--mdfa.bat
|
|--basefile.py
编辑1:当前工作目录从不更改在整个文件中更改
答案 0 :(得分:0)
我怀疑\转义。您是否考虑过像这样打电话:
subprocess.run([r"tools\aAIvwb.bat"], creationflags=0x08000000)
请注意,我在双引号前加上了'r'。