Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中为多输入执行Fortran程序_Python_Python 2.7_Python 3.x_Bioinformatics_Biopython - Fatal编程技术网

如何在python中为多输入执行Fortran程序

如何在python中为多输入执行Fortran程序,python,python-2.7,python-3.x,bioinformatics,biopython,Python,Python 2.7,Python 3.x,Bioinformatics,Biopython,我有一个Fortran程序,想用python为多个文件执行它。我有2000个输入文件,但在我的Fortran代码中,我一次只能运行一个文件。我应该如何在python中调用Fortran程序 我的脚本: import subprocess import glob input = glob.glob('C:/Users/Vishnu/Desktop/Fortran_Program_Rum/*.txt') output = glob.glob('C:/Users/Vishnu/Desktop/Fort

我有一个Fortran程序,想用python为多个文件执行它。我有2000个输入文件,但在我的Fortran代码中,我一次只能运行一个文件。我应该如何在python中调用Fortran程序

我的脚本:

import subprocess
import glob
input = glob.glob('C:/Users/Vishnu/Desktop/Fortran_Program_Rum/*.txt')
output = glob.glob('C:/Users/Vishnu/Desktop/Fortran_Program_Rum/Output/')
f = open("output", "w")
for i in input:
    subprocess.Popen(["FORTRAN ~/C:/Users/Vishnu/Desktop/Fortran_Program_Rum/phase1.f", "--domain "+i])
f.write(i)
Traceback (most recent call last):
  File "<pyshell#14>", line 2, in <module>
subprocess.Popen(["FORTRAN ~/C:/Users/Vishnu/Desktop/Fortran_Program_Rum/phase1.f", "--domain "+i])
  File "C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
  File "C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
错误:

import subprocess
import glob
input = glob.glob('C:/Users/Vishnu/Desktop/Fortran_Program_Rum/*.txt')
output = glob.glob('C:/Users/Vishnu/Desktop/Fortran_Program_Rum/Output/')
f = open("output", "w")
for i in input:
    subprocess.Popen(["FORTRAN ~/C:/Users/Vishnu/Desktop/Fortran_Program_Rum/phase1.f", "--domain "+i])
f.write(i)
Traceback (most recent call last):
  File "<pyshell#14>", line 2, in <module>
subprocess.Popen(["FORTRAN ~/C:/Users/Vishnu/Desktop/Fortran_Program_Rum/phase1.f", "--domain "+i])
  File "C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
  File "C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
回溯(最近一次呼叫最后一次):
文件“”,第2行,在
subprocess.Popen([“FORTRAN~/C:/Users/Vishnu/Desktop/FORTRAN_Program_Rum/phase1.f”,“--domain”+i])
文件“C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py”,第947行,在\uuu init中__
恢复信号,启动新会话)
文件“C:\Users\Vishnu\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py”,第1224行,在执行子进程中
startupinfo)
FileNotFoundError:[WinError 2]系统找不到指定的文件

也许在这个线程中调用带有
子进程的fortran程序

e、 g


另外,

也许在这个线程中调用带有
子进程的fortran程序

e、 g


另外,

您能用代码解释一下吗?我对pythonI不太熟悉我无法运行多输入文件的fortran程序,你能指导我吗?我已经编辑了我的问题,请检查一次并指导我,阅读你的错误消息,你的文件的路径没有正确指定,因为找不到..我已经检查了给定的路径,但它没有问题,你能检查一下我的代码是否正确吗?请引导我,亲爱的,你能用代码解释一下吗?我对pythonI不太熟悉我无法运行多输入文件的fortran程序,你能指导我吗?我已经编辑了我的问题,请检查一次并指导我,阅读你的错误消息,你的文件的路径没有正确指定,因为找不到..我已经检查了给定的路径,但它没有问题,你能检查一下我的代码是否正确吗?亲爱的,请引导我