Python调用脚本仍然失败

2024-04-25 05:45:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我花了几个小时试图运行这个脚本,但由于某些原因,它根本无法正常运行“性”现在是一个全球性的安装,所以它称之为罚款,但其他东西似乎失败了。不幸的是,看起来失败的东西是它应该创造的东西。我甚至在def语句之后添加了一个简单的print语句,它不会打印,只是自动失败了。有什么见解吗

代码:

def objmask(inimgs, inwhts, thresh1='20.0', thresh2='2.0', tfdel=True, 
            xceng=3001., yceng=3001., outdir='.', tmpdir='tmp'):
    print "c"
# initial detection of main galaxy with SExtractor for re-centering purposes
    if outdir!='.':
        if not os.path.exists(outdir):
            os.makedirs(outdir)
    print inimgs

    if not os.path.exists(tmpdir):
        os.makedirs(tmpdir)
    for c in range(np.size(inimgs)):
        print 'Creating Aperture Run:', c
        subprocess.call(['sex',inimgs[c],'-c','/home/vidur/se_files/gccg.sex',
                         '-CATALOG_NAME','/home/vidur/se_files/tmp'+str(c)+'.cat',
                         '-PARAMETERS_NAME','/home/vidur/se_files/gccg_ell.param',
                         '-FILTER_NAME','/home/vidur/se_files/gccg.conv',
                         '-STARNNW_NAME','/home/vidur/se_files/gccg.nnw',
                         '-CHECKIMAGE_TYPE','APERTURES',
                         '-VERBOSE_TYPE','QUIET',
                         '-DETECT_THRESH',thresh1,
                         '-ANALYSIS_THRESH',thresh2,
                         '-WEIGHT_IMAGE',inwhts[c]],shell=True
                         )

错误:

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
/home/vidur/se_files/<ipython-input-2-bbc58f9e134a> in <module>()
----> 1 fetch_swarp2.objmask(['sciPHOTOf105w0.fits'],['whtPHOTOf105w0.fits'])

/home/vidur/se_files/fetch_swarp2.pyc in objmask(inimgs, inwhts, thresh1, thresh2, tfdel, xceng, yceng, outdir, tmpdir)
    116         secat=asciitable.read('./se_files/_tmp_seobj'+str(c)+'.cat',
    117                               names=['flux','ferr','xmin','ymin','xmax','ymax',
--> 118                                      'xc','yc','cxx','cyy','cxy'])
    119         robj = np.sqrt((secat['xc']-xceng)**2.0+(secat['yc']-yceng)**2.0)
    120         rmin = (robj==np.min(robj))

/usr/local/lib/python2.7/dist-packages/asciitable-0.8.0-py2.7.egg/asciitable/ui.pyc in read(table, numpy, guess, **kwargs)
    129         guess = _GUESS
    130     if guess:
--> 131         dat = _guess(table, new_kwargs)
    132     else:
    133         reader = get_reader(**new_kwargs)

/usr/local/lib/python2.7/dist-packages/asciitable-0.8.0-py2.7.egg/asciitable/ui.pyc in _guess(table, read_kwargs)
    173         try:
    174             reader = get_reader(**guess_kwargs)
--> 175             dat = reader.read(table)
    176             # When guessing impose additional requirements on column names and number of cols

    177             bads = [" ", ",", "|", "\t", "'", '"']

/usr/local/lib/python2.7/dist-packages/asciitable-0.8.0-py2.7.egg/asciitable/core.pyc in read(self, table)
    839         self.header.data = self.data
    840 
--> 841         self.lines = self.inputter.get_lines(table)
    842         self.data.get_data_lines(self.lines)
    843         self.header.get_cols(self.lines)

/usr/local/lib/python2.7/dist-packages/asciitable-0.8.0-py2.7.egg/asciitable/core.pyc in get_lines(self, table)
    155                 table = table.read()
    156             elif '\n' not in table and '\r' not in table + '':
--> 157                 table = open(table, 'r').read()
    158             lines = table.splitlines()
    159         except TypeError:

IOError: [Errno 2] No such file or directory: './se_files/_tmp_seobj0.cat'

错误中最相关的部分似乎是结束

我运行Ubuntu 12.04 32位


Tags: inselfhomereadgettablefilespyc