空闲时出现异常(python 2.7) - 空闲时可能出现错误?

时间:2014-06-24 19:57:46

标签: database sockets python-2.7 python-idle neuroscience

我尝试使用neurosynth python library通过空闲来对fMRI数据的数据库进行元分析。当我尝试运行一些最基本的函数时,我得到一个错误,而不是我自己的代码错误,或者在neurosynth模块中,错误似乎是空闲本身的错误。

我卸载并重新安装了python 2.7,重新安装了neurosynth及其依赖项,并遇到了同样的错误。我在下面粘贴了我的代码,然后是错误消息,它出现在unix shell中(不在空闲shell中)。

有没有人在使用idle和python 2.7之前遇到过这个错误?

剧本:

from neurosynth.base.dataset import Dataset
from neurosynth.analysis import meta, decode, network
import neurosynth

neurosynth.set_logging_level('info')

dataset = Dataset('data/database.txt')
dataset.add_features('data/features.txt')
dataset.save('dataset.pkl')

print 'done'

unix shell中出现的错误消息:

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 46779)
Request:  <socket._socketobject object at 0xcb8d7c0>
Traceback (most recent call last):
  File "/usr/global/python/2.7.3/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/global/python/2.7.3/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/global/python/2.7.3/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 503, in __init__
    SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/usr/global/python/2.7.3/lib/python2.7/SocketServer.py", line 638, in __init__
    self.handle()
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/run.py", line 265, in handle
    rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 300, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 424, in pollresponse
    message = self.pollmessage(wait)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 376, in pollmessage
    packet = self.pollpacket(wait)
  File "/usr/global/python/2.7.3/lib/python2.7/idlelib/rpc.py", line 347, in pollpacket
    r, w, x = select.select([self.sock.fileno()], [], [], wait)
error: (4, 'Interrupted system call')

*** Unrecoverable, server exiting!
----------------------------------------

提前致谢!

1 个答案:

答案 0 :(得分:0)

Idle用于在shell中进行交互式探索,在编辑器中进行编辑,以及通过从编辑器运行来测试程序。它不适用于一旦开发的程序的生产运行。如果出现问题,应该将Idle部分与使用Python部分的运行分开。所以在unix shell中,运行python -m idlelib(例如)以查看Idle是否正确启动。然后,在适当的目录中,运行python path-to-my-file.py。哪个不起作用?

错误消息绝对是奇怪的,因为它不仅仅是python回溯。另一方面,它不是从代码行开始的。我不知道为什么选择呼叫会被中断。