3

在我正在开发的应用程序引擎应用程序的本地实例上,我正在经历日志系统的无限递归。不幸的是,由于问题出在日志系统上,我看不到错误消息。python 'print' 命令也不适用于谷歌应用引擎应用程序,因此我无法显示任何有用的信息。

即使只是访问网站根目录,问题也很明显。

这似乎是一个导入问题,但除此之外,日志系统应该可以工作,但它没有。

该站点的已部署版本正在运行,这使我想到了可能的本地配置/系统问题。

我正在使用 python 2.7.2 和 CURRENT_VERSION_ID=1.1

这是错误的很长的堆栈跟踪:

    --> --> -->
Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2781, in _HandleRequest
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2669, in _Dispatch
    base_env_dict=env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 692, in Dispatch
    base_env_dict=base_env_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1731, in Dispatch
    self._module_dict)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1631, in ExecuteCGI
    reset_modules = exec_script(config, handler_path, cgi_path, hook)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1319, in ExecuteOrImportScript
    exec module_code in script_module.__dict__
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 79, in <module>
    from google.appengine.ext.webapp import _template
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1858, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule
    description)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted
    description)
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_template.py", line 37, in <module>
    from google.appengine.ext.webapp import template
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1858, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1722, in FindAndLoadModule
    description)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted
    description)
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\template.py", line 61, in <module>
    webapp._config_handle.django_setup()
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 153, in _django_setup
    __django_version_setup()
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 99, in __django_version_setup
    'http://code.google.com/appengine/docs/python/tools/'
  File "C:\Python27\lib\logging\__init__.py", line 1582, in warning
    root.warning(msg, *args, **kwargs)
  File "C:\Python27\lib\logging\__init__.py", line 1144, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1250, in _log
    self.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "C:\Python27\lib\logging\__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "C:\Python27\lib\logging\__init__.py", line 744, in handle
    self.emit(record)
  File "C:\Python27\lib\logging\__init__.py", line 870, in emit
    self.handleError(record)
  File "C:\Python27\lib\logging\__init__.py", line 797, in handleError
    None, sys.stderr)
  File "C:\Python27\lib\traceback.py", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "C:\Python27\lib\traceback.py", line 13, in _print
    file.write(str+terminator)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1492, in write
    logging.getLogger()._log(logging.ERROR, message, ())
  File "C:\Python27\lib\logging\__init__.py", line 1249, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
  File "C:\Python27\lib\logging\__init__.py", line 1223, in makeRecord
    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
  File "C:\Python27\lib\logging\__init__.py", line 266, in __init__
    self.levelname = getLevelName(level)
  File "C:\Python27\lib\logging\__init__.py", line 167, in getLevelName
    return _levelNames.get(level, ("Level %s" % level))
RuntimeError: maximum recursion depth exceeded while getting the str of an object

以下是 main.py 的导入列表:

from google.appengine.ext import webapp

import fix_path
import sys
import os
import urllib
import urllib2
import pprint
import logging
import cgi
import random
import Cookie
import datetime
import time
import urlparse
import urllib2
import urllib, cStringIO
import hashlib
import copy

from urllib import urlretrieve
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.dist import use_library
from google.appengine.api import memcache
from django.utils import simplejson
from gaesessions import get_current_session

from myapp.models import *
from myapp.models import sequence_selection as models_sequence_selection
from myapp.sequence_selection import utils as sequence_selection_utils
from myapp.models import video 
from myapp.models.video import * 
from myapp.models.song import * 
from myapp.models.flashified import *
from myapp.music_recommendation import get_song_recommendations,get_song_recommendations_learning_data,learn_song,learn_song_from_video

from myapp.core import is_number
from myapp import mailing
from myapp import search
from myapp import motif
from myapp import retrieve_instagram
from myapp import coords_distance
from myapp import performancetest

from google.appengine.api import mail
from google.appengine.api import images

实际上,重命名应用程序的目录并使用不同的端口重新导入谷歌应用程序引擎启动器解决了我的问题,但可能不是错误。

4

1 回答 1

1

正如@skreft 所说,您需要上传相关来源以获得真正的答案。

尽管就日志记录而言,使用import logging然后logging.info()来帮助定位问题。

我建议现在评论日志代码,看看你的堆栈跟踪揭示了什么。然后,如果您没有收到错误,请开始逐段添加日志记录代码,直到找到错误为止。

于 2012-06-06T18:57:37.403 回答