2012-06-06 57 views
2

在我正在開發的應用程序引擎應用程序的本地實例中,我遇到了日誌系統的無限遞歸。不幸的是,由於問題出在日誌系統上,所以我看不到錯誤信息。 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 

實際上,重命名應用程序的目錄並重新導入谷歌應用程序引擎啓動器與不同的端口解決了我的問題,但可能不是錯誤。

+1

您是否可以發佈代碼摘錄? –

+0

實際上,main.py是一個包含數千行的巨大文件。我也不確定它是問題的根源,因爲遞歸是在日誌記錄模塊中進行的。這也似乎是我最近的變化與錯誤無關,因爲我已經撤消了它們,錯誤仍然存​​在。 – fstab

+1

至少回覆您發佈的回溯表明,當您導入模塊時(從myapp.music_recommendation導入get_song_recommendations,get_song_recommendations_learning_data,learn_song,learn_song_from_video和從myapp.models.song導入歌曲),問題源於此。你還使用什麼Python版本和dev_appserver? –

回答

1

您需要上傳相關資源才能獲得真實答案,如@skreft所述。

儘管記錄,使用import logging,然後logging.info()來幫助找到問題。

我建議現在評論日誌代碼,看看你的堆棧跟蹤揭示了什麼。然後,如果您沒有收到錯誤,請開始逐個添加日誌記錄代碼,直到找到錯誤。