编辑:原来这是reddit和最新(0.14)版本的pycountry的某种兼容性问题。easy_install'd 0.12.1 现在一切正常
我正在尝试设置一个 reddit 实例并遇到此错误
这是堆栈跟踪
File '/usr/local/lib/python2.6/dist-packages/Pylons-0.9.6.2-py2.6.egg/pylons/error.py', line 245 in respond
app_iter = self.application(environ, detect_start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 302 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 427 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 371 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 386 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 107 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 107 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 107 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 500 in __call__
return self.app(environ, start_response)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 523 in __call__
return self.app(environ, custom_start_response)
File '/usr/local/lib/python2.6/dist-packages/Pylons-0.9.6.2-py2.6.egg/pylons/wsgiapp.py', line 314 in __call__
return self.app(environ, start_response)
File '/usr/local/lib/python2.6/dist-packages/Beaker-1.5.4-py2.6.egg/beaker/middleware.py', line 73 in __call__
return self.app(environ, start_response)
File '/usr/local/lib/python2.6/dist-packages/Beaker-1.5.4-py2.6.egg/beaker/middleware.py', line 152 in __call__
return self.wrap_app(environ, session_start_response)
File '/usr/local/lib/python2.6/dist-packages/Routes-1.8-py2.6.egg/routes/middleware.py', line 99 in __call__
response = self.app(environ, start_response)
File '/usr/local/lib/python2.6/dist-packages/Pylons-0.9.6.2-py2.6.egg/pylons/wsgiapp.py', line 94 in __call__
controller = self.resolve(environ, start_response)
File '/usr/local/lib/python2.6/dist-packages/Pylons-0.9.6.2-py2.6.egg/pylons/wsgiapp.py', line 170 in resolve
return self.find_controller(controller)
File '/home/reddit/reddit/r2/r2/config/middleware.py', line 534 in find_controller
__import__(self.package_name + '.controllers')
File '/home/reddit/reddit/r2/r2/controllers/__init__.py', line 22 in <module>
from listingcontroller import ListingController
File '/home/reddit/reddit/r2/r2/controllers/listingcontroller.py', line 22 in <module>
from reddit_base import RedditController, base_listing, organic_pos
File '/home/reddit/reddit/r2/r2/controllers/reddit_base.py', line 28 in <module>
from r2.lib import pages, utils, filters, amqp
File '/home/reddit/reddit/r2/r2/lib/pages/__init__.py', line 22 in <module>
from pages import *
File '/home/reddit/reddit/r2/r2/lib/pages/pages.py', line 55 in <module>
import graph, pycountry, time
File '/usr/local/lib/python2.6/dist-packages/pycountry-0.14-py2.6.egg/pycountry/__init__.py', line 16 in <module>
class Countries(pycountry.db.Database):
AttributeError: 'module' object has no attribute 'db'
第 16 行class Countries(pycountry.db.Database):
前面import pycountry.db
有几行,所以如果“pycountry.db.Database”抛出关于模块对象没有属性 db 的错误,那么该import
行不应该也抛出错误吗?我能做些什么?