Google App Engine - Hello World Tutorial - 分段错误

时间:2011-02-18 17:30:29

标签: python google-app-engine segmentation-fault

我刚刚开始使用谷歌应用引擎,刚刚开始运行教程。当我这样做时:

$ python2.5 google_appengine/dev_appserver.py helloworld/ 

它说'分段错误'。

我正在运行Ubuntu 10.10。我在this site的帮助下从网站安装了Python 2.5。

我在命令开头有python2.5的原因是我做了一个Python 2.5的altinstall,所以我仍然可以使用Python 2.7。

一切看起来都应该有效,但事实并非如此。有谁知道我的问题是什么?

我能够以交互方式运行Python 2.5。只有当我运行dev_appserver.py时才会出现seg故障。我做了更多测试,甚至在我刚开始运行时:

$ ./google_appengine/dev_appserver.py
它给了我一个段错误。我不知道这是否有帮助,但我认为可能。

我用详细输出运行它:

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.5/site.pyc matches /usr/local/lib/python2.5/site.py
import site # precompiled from /usr/local/lib/python2.5/site.pyc
# /usr/local/lib/python2.5/os.pyc matches /usr/local/lib/python2.5/os.py
import os # precompiled from /usr/local/lib/python2.5/os.pyc
import errno # builtin
import posix # builtin
# /usr/local/lib/python2.5/posixpath.pyc matches /usr/local/lib/python2.5/posixpath.py
import posixpath # precompiled from /usr/local/lib/python2.5/posixpath.pyc
# /usr/local/lib/python2.5/stat.pyc matches /usr/local/lib/python2.5/stat.py
import stat # precompiled from /usr/local/lib/python2.5/stat.pyc
# /usr/local/lib/python2.5/UserDict.pyc matches /usr/local/lib/python2.5/UserDict.py
import UserDict # precompiled from /usr/local/lib/python2.5/UserDict.pyc
# /usr/local/lib/python2.5/copy_reg.pyc matches /usr/local/lib/python2.5/copy_reg.py
import copy_reg # precompiled from /usr/local/lib/python2.5/copy_reg.pyc
# /usr/local/lib/python2.5/types.pyc matches /usr/local/lib/python2.5/types.py
import types # precompiled from /usr/local/lib/python2.5/types.pyc
import _types # builtin
# /usr/local/lib/python2.5/warnings.pyc matches /usr/local/lib/python2.5/warnings.py
import warnings # precompiled from /usr/local/lib/python2.5/warnings.pyc
# /usr/local/lib/python2.5/linecache.pyc matches /usr/local/lib/python2.5/linecache.py
import linecache # precompiled from /usr/local/lib/python2.5/linecache.pyc
import encodings # directory /usr/local/lib/python2.5/encodings
# /usr/local/lib/python2.5/encodings/__init__.pyc matches /usr/local/lib/python2.5/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.5/encodings/__init__.pyc
# /usr/local/lib/python2.5/codecs.pyc matches /usr/local/lib/python2.5/codecs.py
import codecs # precompiled from /usr/local/lib/python2.5/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.5/encodings/aliases.pyc matches /usr/local/lib/python2.5/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.5/encodings/aliases.pyc
# /usr/local/lib/python2.5/encodings/utf_8.pyc matches /usr/local/lib/python2.5/encodings/utf_8.py
import encodings.utf_8 # precompiled from /usr/local/lib/python2.5/encodings/utf_8.pyc
Python 2.5.5 (r255:77872, Feb 17 2011, 21:03:23) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import google # directory /home/admin/google_app_engine/google_appengine/google
# /home/admin/google_app_engine/google_appengine/google/__init__.pyc matches /home/admin/google_app_engine/google_appengine/google/__init__.py
import google # precompiled from /home/admin/google_app_engine/google_appengine/google/__init__.pyc
import google.appengine # directory /home/admin/google_app_engine/google_appengine/google/appengine
# /home/admin/google_app_engine/google_appengine/google/appengine/__init__.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/__init__.py
import google.appengine # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/__init__.pyc
import google.appengine.tools # directory /home/admin/google_app_engine/google_appengine/google/appengine/tools
# /home/admin/google_app_engine/google_appengine/google/appengine/tools/__init__.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/tools/__init__.py
import google.appengine.tools # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/tools/__init__.pyc
# /home/admin/google_app_engine/google_appengine/google/appengine/tools/os_compat.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/tools/os_compat.py
import google.appengine.tools.os_compat # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/tools/os_compat.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/time.so", 2);
import time # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/time.so
# /usr/local/lib/python2.5/getopt.pyc matches /usr/local/lib/python2.5/getopt.py
import getopt # precompiled from /usr/local/lib/python2.5/getopt.pyc
import logging # directory /usr/local/lib/python2.5/logging
# /usr/local/lib/python2.5/logging/__init__.pyc matches /usr/local/lib/python2.5/logging/__init__.py
import logging # precompiled from /usr/local/lib/python2.5/logging/__init__.pyc
# /usr/local/lib/python2.5/string.pyc matches /usr/local/lib/python2.5/string.py
import string # precompiled from /usr/local/lib/python2.5/string.pyc
# /usr/local/lib/python2.5/re.pyc matches /usr/local/lib/python2.5/re.py
import re # precompiled from /usr/local/lib/python2.5/re.pyc
# /usr/local/lib/python2.5/sre_compile.pyc matches /usr/local/lib/python2.5/sre_compile.py
import sre_compile # precompiled from /usr/local/lib/python2.5/sre_compile.pyc
import _sre # builtin
# /usr/local/lib/python2.5/sre_constants.pyc matches /usr/local/lib/python2.5/sre_constants.py
import sre_constants # precompiled from /usr/local/lib/python2.5/sre_constants.pyc
# /usr/local/lib/python2.5/sre_parse.pyc matches /usr/local/lib/python2.5/sre_parse.py
import sre_parse # precompiled from /usr/local/lib/python2.5/sre_parse.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/strop.so", 2);
import strop # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/strop.so
dlopen("/usr/local/lib/python2.5/lib-dynload/cStringIO.so", 2);
import cStringIO # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/cStringIO.so
# /usr/local/lib/python2.5/traceback.pyc matches /usr/local/lib/python2.5/traceback.py
import traceback # precompiled from /usr/local/lib/python2.5/traceback.pyc
import thread # builtin
# /usr/local/lib/python2.5/threading.pyc matches /usr/local/lib/python2.5/threading.py
import threading # precompiled from /usr/local/lib/python2.5/threading.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/collections.so", 2);
import collections # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/collections.so
# /usr/local/lib/python2.5/atexit.pyc matches /usr/local/lib/python2.5/atexit.py
import atexit # precompiled from /usr/local/lib/python2.5/atexit.pyc
# /usr/local/lib/python2.5/tempfile.pyc matches /usr/local/lib/python2.5/tempfile.py
import tempfile # precompiled from /usr/local/lib/python2.5/tempfile.pyc
# /usr/local/lib/python2.5/random.pyc matches /usr/local/lib/python2.5/random.py
import random # precompiled from /usr/local/lib/python2.5/random.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/math.so", 2);
import math # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/math.so
dlopen("/usr/local/lib/python2.5/lib-dynload/binascii.so", 2);
import binascii # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/binascii.so
dlopen("/usr/local/lib/python2.5/lib-dynload/_random.so", 2);
import _random # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/_random.so
dlopen("/usr/local/lib/python2.5/lib-dynload/fcntl.so", 2);
import fcntl # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/fcntl.so
import google.appengine.api # directory /home/admin/google_app_engine/google_appengine/google/appengine/api
# /home/admin/google_app_engine/google_appengine/google/appengine/api/__init__.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/api/__init__.py
import google.appengine.api # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/api/__init__.pyc
# /home/admin/google_app_engine/google_appengine/google/appengine/api/yaml_errors.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/api/yaml_errors.py
import google.appengine.api.yaml_errors # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/api/yaml_errors.pyc
import google.appengine.dist # directory /home/admin/google_app_engine/google_appengine/google/appengine/dist
# /home/admin/google_app_engine/google_appengine/google/appengine/dist/__init__.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/dist/__init__.py
import google.appengine.dist # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/dist/__init__.pyc
# /home/admin/google_app_engine/google_appengine/google/appengine/dist/_library.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/dist/_library.py
import google.appengine.dist._library # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/dist/_library.pyc
import distutils # directory /usr/local/lib/python2.5/distutils
# /usr/local/lib/python2.5/distutils/__init__.pyc matches /usr/local/lib/python2.5/distutils/__init__.py
import distutils # precompiled from /usr/local/lib/python2.5/distutils/__init__.pyc
# /usr/local/lib/python2.5/distutils/version.pyc matches /usr/local/lib/python2.5/distutils/version.py
import distutils.version # precompiled from /usr/local/lib/python2.5/distutils/version.pyc
# /home/admin/google_app_engine/google_appengine/google/appengine/dist/py_zipimport.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/dist/py_zipimport.py
import google.appengine.dist.py_zipimport # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/dist/py_zipimport.pyc
# /usr/local/lib/python2.5/zipfile.pyc matches /usr/local/lib/python2.5/zipfile.py
import zipfile # precompiled from /usr/local/lib/python2.5/zipfile.pyc
# /usr/local/lib/python2.5/struct.pyc matches /usr/local/lib/python2.5/struct.py
import struct # precompiled from /usr/local/lib/python2.5/struct.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/_struct.so", 2);
import _struct # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/_struct.so
dlopen("/usr/local/lib/python2.5/lib-dynload/zlib.so", 2);
import zlib # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/zlib.so
# /home/admin/google_app_engine/google_appengine/google/appengine/tools/appcfg.pyc matches /home/admin/google_app_engine/google_appengine/google/appengine/tools/appcfg.py
import google.appengine.tools.appcfg # precompiled from /home/admin/google_app_engine/google_appengine/google/appengine/tools/appcfg.pyc
# /usr/local/lib/python2.5/calendar.pyc matches /usr/local/lib/python2.5/calendar.py
import calendar # precompiled from /usr/local/lib/python2.5/calendar.pyc
# /usr/local/lib/python2.5/__future__.pyc matches /usr/local/lib/python2.5/__future__.py
import __future__ # precompiled from /usr/local/lib/python2.5/__future__.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/datetime.so", 2);
import datetime # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/datetime.so
# /usr/local/lib/python2.5/locale.pyc matches /usr/local/lib/python2.5/locale.py
import locale # precompiled from /usr/local/lib/python2.5/locale.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/_locale.so", 2);
import _locale # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/_locale.so
dlopen("/usr/local/lib/python2.5/lib-dynload/operator.so", 2);
import operator # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/operator.so
# /usr/local/lib/python2.5/getpass.pyc matches /usr/local/lib/python2.5/getpass.py
import getpass # precompiled from /usr/local/lib/python2.5/getpass.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/termios.so", 2);
import termios # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/termios.so
# /usr/local/lib/python2.5/mimetypes.pyc matches /usr/local/lib/python2.5/mimetypes.py
import mimetypes # precompiled from /usr/local/lib/python2.5/mimetypes.pyc
# /usr/local/lib/python2.5/urllib.pyc matches /usr/local/lib/python2.5/urllib.py
import urllib # precompiled from /usr/local/lib/python2.5/urllib.pyc
# /usr/local/lib/python2.5/socket.pyc matches /usr/local/lib/python2.5/socket.py
import socket # precompiled from /usr/local/lib/python2.5/socket.pyc
import _socket # builtin
import _ssl # builtin
# /usr/local/lib/python2.5/urlparse.pyc matches /usr/local/lib/python2.5/urlparse.py
import urlparse # precompiled from /usr/local/lib/python2.5/urlparse.pyc
# /usr/local/lib/python2.5/optparse.pyc matches /usr/local/lib/python2.5/optparse.py
import optparse # precompiled from /usr/local/lib/python2.5/optparse.pyc
# /usr/local/lib/python2.5/textwrap.pyc matches /usr/local/lib/python2.5/textwrap.py
import textwrap # precompiled from /usr/local/lib/python2.5/textwrap.pyc
# /usr/local/lib/python2.5/gettext.pyc matches /usr/local/lib/python2.5/gettext.py
import gettext # precompiled from /usr/local/lib/python2.5/gettext.pyc
# /usr/local/lib/python2.5/copy.pyc matches /usr/local/lib/python2.5/copy.py
import copy # precompiled from /usr/local/lib/python2.5/copy.pyc
# /usr/local/lib/python2.5/sha.pyc matches /usr/local/lib/python2.5/sha.py
import sha # precompiled from /usr/local/lib/python2.5/sha.pyc
# /usr/local/lib/python2.5/hashlib.pyc matches /usr/local/lib/python2.5/hashlib.py
import hashlib # precompiled from /usr/local/lib/python2.5/hashlib.pyc
dlopen("/usr/local/lib/python2.5/lib-dynload/_hashlib.so", 2);
import _hashlib # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/_hashlib.so
Segmentation fault

我检查了详细输出并注意到最下面一行是

import _hashlib # dynamically loaded from /usr/local/lib/python2.5/lib-dynload/_hashlib.so

所以我运行了几个测试,当我以交互方式运行Python 2.5并尝试导入_hashlib模块时,它没有错误。

我也去了this blog并尝试了他的方法。这也不起作用。

1 个答案:

答案 0 :(得分:0)

抱歉,没有代表留下评论,所以我不得不留下这个作为答案。

假设您已经确认您的Google应用引擎安装没有损坏,我的第一个本能是python2.5安装使用python2.7中的一些文件,导致它出现段错误。尝试运行strace -o "log.txt" python2.5 ./google_appengine/dev_appserver.py。这将为log.txt提供大量输出,因此请尝试使用grepping来查找从2.7安装中加载的任何文件。

如果这没有导致任何结果,请尝试在gdb下运行以获取堆栈跟踪。这需要安装带有调试符号的python解释器 - 可能不是你想听到的,但这是找出正在发生的事情的最快方法。这里的说明:http://wiki.python.org/moin/DebuggingWithGdb如果堆栈跟踪没有明显发生了什么,那么将它发布到python邮件列表或错误跟踪器,他们应该能够帮助你。