1

IOError在一个代码中发生了一件事情,除了这种情况外,它可以正常工作。我的完整追溯是,

Traceback (most recent call last):
  File "Utt_test.py", line 962, in <module>
IOError: [Errno 5] Input/output error: '/SAH/SAH5/jimunoz/DUSTYlib2/models_Y400_1499K/COMPACTs3200_SiW_g+1.5_m1.0_t02_st_z+0.0
close failed in file object destructor:
IOError: [Errno 5] Input/output error
close failed in file object destructor:
IOError: [Errno 5] Input/output error

这是给出错误的代码部分,

  #print 'Begin outer loop: Accessing the full DUSTY Models through the .tbl'
  for i in range(BestX):
   Tin=model[BestFitsModel[0][i]][2]
   Tau2=np.append(Tau2,model[BestFitsModel[0][i]][6])
   Dir=model[BestFitsModel[0][i]][0]
   Dir=Dir.replace('inp','out',1) ##replaces inp file-name extension with out, opens up correct .out file

   with open(Dir.replace('inp','out',1),'rb') as T: #This is line 962
    Tau = [line.split() for line in T if line.strip()]

(上面代码块的倒数第二行)

简而言之,整个代码将观测到的恒星数据与理论模型进行比较。输入参数之一要求最小二乘阈值(如果模型低于阈值,它将将该信息打印到文件中)。到目前为止,代码运行良好,但我决定运行一个比正常值更大的阈值,留到晚上,然后回到这个。阈值越大,需要搜索和打印到文件的模型数量就越多。我在想(可能是错误的)这个动作的持续时间与此有关。但除此之外,我不知道该怎么做。

这对我来说很奇怪,因为该程序可以在较小的值下正常工作。这是怎么回事?

编辑:(经过一些研究)

所以我跑去dmesg看看是什么问题,我得到了这个作为回报,

...
[3755345.325006] nfs: server pa5a not responding, timed out
[3755345.625009] nfs: server pa5a not responding, timed out
[3781101.914024] nfs: server pa5a not responding, timed out
[3781771.727017] nfs: server pa5a not responding, timed out
...

意识到这nfs意味着“网络文件服务器”(也必须查一下),我开始拼凑起来,如果程序需要很长时间,服务器会“让我失望”(可能不是最精确的语言,但我我只是想理解它)。

有没有办法改变一些配置设置来防止这种情况发生?假设我必须在服务器上工作。

4

0 回答 0