GoogleAppEngineLauncher:数据库磁盘映像格式错误

时间:2014-11-22 08:02:52

标签: python google-app-engine sqlite

我为Google App Engine编写了一个小应用程序,每次我想运行我的应用程序时都会出现以下错误:

*** Running dev_appserver with the following flags:
    --skip_sdk_update_check=yes --port=13080 --admin_port=8005 --clear_datastore=yes
Python command: /usr/bin/python2.7
INFO     2014-11-22 07:47:57,008 devappserver2.py:745] Skipping SDK update check.
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 997, in <module>
    main()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 990, in main
    dev_server.start(options)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 789, in start
    request_data, storage_path, options, configuration)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 888, in _create_api_server
    default_gcs_bucket_name=options.default_gcs_bucket_name)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 403, in setup_stubs
    logservice_stub.LogServiceStub(logs_path=logs_path))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/logservice/logservice_stub.py", line 107, in __init__
    self._conn.execute(_REQUEST_LOG_CREATE)
sqlite3.DatabaseError: database disk image is malformed

当我运行我创建的其他应用程序时,我没有任何错误。 我尝试了一些基本的想法:

  • 删除/重新添加应用

  • 删除应用启动器并重新安装

  • 重新启动mac

  • 使用某些grep

  • 找到数据库的位置

没有任何效果。有什么想法吗?

1 个答案:

答案 0 :(得分:5)

默认日志数据库文件名为log.db。它存储在您的应用程序存储目录中,该目录默认位于tempfile.gettempdir()目录中,名为appengine.[appname].[userid]

appname部分从app.yaml获取值(查找application条目),用下划线替换:冒号,并删除最后一个~之前的所有内容1}}代字号(如果有的话)。

因此,如果您的应用名称为foobar且您的用户名为jbj,则损坏的SQLite数据库位于:

`python -c 'import tempfile;print tempfile.gettempdir()'`/appengine.foobar.jbj/log.db

在Mac OS X上,tempfile.gettempdir()/var/folders某处返回散列路径;它只是从TMPDIR环境变量中获取,因此应该才能使用:

rm $TMPDIR/appengine.foobar.jbj/log.db

您可以安全地删除此文件,下次启动应用时会重新创建该文件。