我正在尝试使用Tipfy和Google App Engine运行鼻子测试,但是我一直收到导入错误:

在google_appengine目录中,我执行以下命令(该目录包含dev_appserver.py):

nosetests /Users/me/Documents/python/project/ --with-gae --without-sandbox


但我收到以下错误:

Traceback (most recent call last):
  File "/usr/local/bin/nosetests", line 8, in <module>
    load_entry_point('nose==0.11.4', 'console_scripts', 'nosetests')()
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/core.py", line 117, in __init__
    **extra_args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 816, in __init__
    self.parseArgs(argv)
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/core.py", line 134, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/config.py", line 323, in configure
    self.plugins.configure(options, self)
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 270, in configure
    cfg(options, config)
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 93, in __call__
    return self.call(*arg, **kw)
  File "/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg/nose/plugins/manager.py", line 161, in simple
    result = meth(*arg, **kw)
  File "build/bdist.macosx-10.6-universal/egg/nosegae.py", line 84, in configure
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 51, in <module>
    import fancy_urllib
ImportError: No module named fancy_urllib


我可以无任何错误地加载tipfy hello_world项目,并且我在同一台计算机上有其他App Engine项目,都运行良好。

使用Mac OS X 10.6.6,并且我已经安装了鼻子和鼻子。我也尝试从/ Users / me / Documents / python / project /文件夹中执行相同的命令,但是得到相同的结果

最佳答案

我遇到了同样的问题,这是我的快速解决方案:

修改该文件“ /usr/local/bin/dev_appserver.py”

......
if version_tuple == (2, 4):
  sys.stderr.write('Warning: Python 2.4 is not supported; this program may '
                   'break. Please use version 2.5 or greater.\n')
#Start Change
#DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
DIR_PATH = "/usr/local/google_appengine"
#End Change

SCRIPT_DIR = os.path.join(DIR_PATH, 'google', 'appengine', 'tools')
......


到目前为止对我有用。

10-07 18:59