我有一个 Python 2.5 中的应用程序,用于监听 beanstalk 队列。到目前为止,除了我新买的 MacBook Pro 之外,它在我测试过的所有机器上都运行良好。
在那台计算机上,当我尝试运行它时,出现以下错误:
Traceback (most recent call last):
File "jobs.py", line 181, in <module>
Jobs().start()
File "jobs.py", line 154, in start
self.jobQueue = Queue()
File "src/utils/queue.py", line 16, in __init__
self.connection = serverconn.ServerConn(self.server, self.port)
File "src/beanstalk/serverconn.py", line 25, in __init__
self.poller = select.poll()
AttributeError: 'module' object has no attribute 'poll'
serverconn.py 具有以下导入:
import socket, select
当我尝试从命令行运行它时,它也失败了:
Python 2.5.1 (r251:54863, Jul 23 2008, 11:00:16)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import select
>>> select.poll()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'poll'
您知道会发生什么吗?
PS:尽管我非常有信心这不是源问题,但如果您需要有关失败源的一些背景信息,可以在 [http://pastie.org/399342](这个馅饼)。
Updated:因为我得到的第一个答案推测 Mac OS 是否支持 select.poll() ,但我也有一台 iMac,并且具有完全相同的操作系统版本,并且工作正常:
2009-02-25 00:27:10,067 - Queue - DEBUG - Connecting to BeansTalk daemon @ localhost:11300