【发布时间】:2019-11-15 09:57:27
【问题描述】:
我正在从事一个自动化项目,该项目需要我在 ngspice 中启动模拟,在 .txt 文件中获取数据并退出 ngspice。我有以下代码可以调用 ngspice:
import sys
import os
def invoke_ngspice():
os.system(r"C:\Users\MyPC\Desktop\GUI\ngspice\bin\ngspice_con.exe C:\Users\MyPC\Desktop\GUI\ngspice\bin\test_circuit.circ")
os.system(r"quit")
虽然调用上述函数可以完美地模拟和保存部分,但我无法退出,因为 ngspice 持有执行。有没有干净地退出ngspice?我不想每次都在 ngspice 命令窗口中手动输入 quit 或杀死它,因为模拟时间是可变的。
【问题讨论】: