我想运行一个python脚本。脚本的第一个步骤来运行正常,但在某些时候我有这样的消息:Python错误没有这样的文件或目录,但有文件
Traceback (most recent call last):
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/bin/LaunchTRF.py", line 154, in <module>
iLaunchTRF.run()
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/bin/LaunchTRF.py", line 143, in run
self._launchTRF()
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/bin/LaunchTRF.py", line 101, in _launchTRF
process = subprocess.Popen(cmd.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
2015-08-28 12:38:05 - DetectTEFeatures - ERROR - ERROR when launching 'LaunchTRF.py -i TEs.60bp.fa -o TEs.60bp.fa.SSR.set -m 15 -c -v 0 > launchTRF.log'
Traceback (most recent call last):
File "PASTEClassifier.py", line 199, in <module>
iLaunch.run()
File "PASTEClassifier.py", line 165, in run
iDF.run()
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/commons/tools/DetectTEFeatures.py", line 185, in run
self._detectFeatures()
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/commons/tools/DetectTEFeatures.py", line 204, in _detectFeatures
self._detectTRF()
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/commons/tools/DetectTEFeatures.py", line 267, in _detectTRF
self._logAndRaise("ERROR when launching '%s'" % cmd)
File "/home/chodar/Descargas/00.Comprimidos/REPET_linux-x64-2.2/commons/tools/DetectTEFeatures.py", line 176, in _logAndRaise
raise Exception(errorMsg)
Exception: ERROR when launching 'LaunchTRF.py -i TEs.60bp.fa -o TEs.60bp.fa.SSR.set -m 15 -c -v 0 > launchTRF.log'
我看了一些其他职位有这种类型的错误,并基于这些,我看着如果LaunchTRF.py存在,它在那儿。实际上,当我仅运行LaunchTRF.py而没有任何选项时,我可以看到选项列表和帮助。我在想,丢失的文件是TEs.60bp.fa,但它也存在。
下面是在情况下,线98至103从LaunchTRF.py可能有助于:
def _launchTRF(self):
cmd = "trf %s 2 3 5 80 10 20 %d -h -d" % (self.inFileName, self.maxPeriod)
self._log.debug("Running : %s" % cmd)
process = subprocess.Popen(cmd.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = process.communicate()
self._log.debug("Output:\n%s" % output[0])
任何帮助是受欢迎的。
你可以做一个打印(self.inFileName) 。确保该文件具有完整的路径名不只是blah.txt – FirebladeDan