1

不知何故,我的本地数据存储已损坏,我想清除它,但我没有这样做。

我现在似乎无法运行任何使用数据存储的代码,因为它处于错误状态。

我使用以下命令:

dev_appserver.py --clear_datastore GoogleAppEngine 其中 GoogleAppEngine 是我的应用文件夹

这是控制台上的日志:

由于我使用的是 GO 而不是 JAVA,因此我无法在任何地方找到和删除 ./WEB-INF/appengine-generated/local_db.bin 之类的文件。

M:\nick\svn\projects>dev_appserver.py --clear_datastore GoogleAppEngine
Traceback (most recent call last):
  File "M:\Softwares\Dev Tools\SDK\google_appengine\dev_appserver.py", line 182, in <module>
    _run_file(__file__, globals())
  File "M:\Softwares\Dev Tools\SDK\google_appengine\dev_appserver.py", line 178, in _run_file
    execfile(script_path, globals_)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 689, in <module>
    main()
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 679, in main
    options = PARSER.parse_args()
  File "C:\Python27\lib\argparse.py", line 1688, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "C:\Python27\lib\argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "C:\Python27\lib\argparse.py", line 1926, in _parse_known_args
    start_index = consume_optional(start_index)
  File "C:\Python27\lib\argparse.py", line 1866, in consume_optional
    take_action(action, args, option_string)
  File "C:\Python27\lib\argparse.py", line 1794, in take_action
    action(self, namespace, argument_values, option_string)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\boolean_action.py", line 67, in __call__
    raise ValueError('must be "yes" or "no", not %r' % values)
ValueError: must be "yes" or "no", not 'GoogleAppEngine'

M:\nick\svn\projects>dev_appserver.py --clear_datastore GoogleAppEngine

这是我尝试访问 DataStore Viewer 页面时的屏幕内容。

Traceback (most recent call last):
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\admin\admin_request_handler.py", line 95, in dispatch
    super(AdminRequestHandler, self).dispatch()
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\admin\datastore_viewer.py", line 721, in get
    start))
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\admin\datastore_viewer.py", line 658, in _get_entity_template_data
    cls.NUM_ENTITIES_PER_PAGE)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\tools\devappserver2\admin\datastore_viewer.py", line 131, in _get_entities
    entities = query.Get(count, start)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\datastore.py", line 1674, in Get
    return list(self.Run(limit=limit, offset=offset, **kwargs))
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_query.py", line 2892, in next
    next_batch = self.__batcher.next()
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_query.py", line 2754, in next
    return self.next_batch(self.AT_LEAST_ONE)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_query.py", line 2791, in next_batch
    batch = self.__next_batch.get_result()
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 604, in get_result
    return self.__get_result_hook(self)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_query.py", line 2558, in __query_result_hook
    self.__results = self._process_results(query_result.result_list())
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_query.py", line 2591, in _process_results
    for result in results]
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\datastore\datastore_rpc.py", line 156, in pb_to_query_result
    return self.pb_to_entity(pb)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\datastore.py", line 347, in pb_to_entity
    return Entity._FromPb(pb)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\datastore.py", line 1126, in _FromPb
    (prop.name(), traceback.format_exc()))
Error: Property IdString is corrupt in the datastore:
Traceback (most recent call last):
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\datastore.py", line 1122, in _FromPb
    value = datastore_types.FromPropertyPb(prop)
  File "M:\Softwares\Dev Tools\SDK\google_appengine\google\appengine\api\datastore_types.py", line 1847, in FromPropertyPb
    value = unicode(value, 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xcc in position 14: invalid continuation byte

我不明白为什么以及如何破坏数据存储。我正在用 Go 学习 GAE,这个事件真的让我害怕......

4

2 回答 2

2

第一个回溯会准确地告诉您您做错了什么。你已经通过了--clear_datastore GoogleAppEngine,但它正在等待--clear_datastore=yes GoogleAppEngine(或“否”)。

正确的语法已记录在案

于 2013-05-22T09:24:53.493 回答
0

对于 Java 用户解决方案是:删除 local_db.bin 文件

于 2015-07-31T18:48:12.793 回答