【发布时间】:2020-11-30 16:47:29
【问题描述】:
我有以下批次用于启动 eclipse/tasking 为我的 C 项目生成 makefile:
test_eclipsec.bat
echo off
set my_eclipse=C:\Program Files\TASKING\TriCore v6.3r1\ctc\eclipse
set my_workspace=C:\Users\firsname.name\Desktop\Repositories\PF_SW
set my_project=xxx
set my_project_config=Release
echo Generating Makefiles
"%my_eclipse%\eclipsec.exe" -nosplash -application com.tasking.managedbuilder.headlessbuild -data %my_workspace% -generateMakefile %my_project%/%my_project_config%
echo Generating Makefiles end
这个脚本本身运行良好。
但我希望从我的 Python 脚本启动这个批处理脚本。 所以在我的 Python 脚本中,我调用了以下函数:
def generate_makefile(self):
batch_path = Path("msw/support/build/test_eclipsec.bat")
subprocess.run(batch_path)
python 脚本打印以下行:
生成 Makefiles
这是我的批处理脚本中的回声。 但随后 Python 脚本被阻止。它没有其他任何东西(它应该),我必须手动停止我的 Python 脚本的执行。 好像是在执行 eclipse 时卡住了。
我还尝试使用 subprocess.run() 直接从 python 运行 eclipse cmd 行。但它也会卡住。
我不知道如何解决这个问题。 任何帮助将不胜感激。
【问题讨论】:
标签: python eclipse batch-file subprocess