[英]Executing command line program (Abaqus-python script) from python script
I am trying to run an Abaqus-python script file from another python script executed in Spyder (python 3.7, windows 10).我正在尝试从在 Spyder 中执行的另一个 python 脚本(python 3.7,windows 10)运行 Abaqus-python 脚本文件。
If I run the following command in CMD abaqus cae -noGUI model.py
the code executes as expected.如果我在 CMD
abaqus cae -noGUI model.py
中运行以下命令,代码将按预期执行。 However, if I try to run cp = subprocess.run('abaqus cae -noGUI model.py',shell=True)
I don't get any output.但是,如果我尝试运行
cp = subprocess.run('abaqus cae -noGUI model.py',shell=True)
我没有得到任何 output。 Below is what is returned in cp.以下是 cp 中返回的内容。
Notes:笔记:
After a fair amount of digging, I think the issue is that the PATH for my python install is done thought Anaconda so I have a different path this vs CMD.经过大量挖掘后,我认为问题在于我的 python 安装的 PATH 已经完成,因为 Anaconda 所以我的路径与 CMD 不同。 I fixed this by adding the full Abaqus location to the command.
我通过将完整的 Abaqus 位置添加到命令来解决此问题。 See below.
见下文。
subprocess.call(r'C:\SIMULIA\Commands\abaqus job=Job-1 ask_delete=OFF interactive', shell=True) subprocess.call(r'C:\SIMULIA\Commands\abaqus job=Job-1 ask_delete=OFF interactive', shell=True)
I am not sure what your problem is due to, but note that Abaqus scripting is based on python 2.7, therefore you might need to downgrade it我不确定您的问题是什么引起的,但请注意 Abaqus 脚本基于 python 2.7,因此您可能需要降级它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.