6

将数据插入我的 MySQL 数据库时出现此错误

ValueError at /admin/arbkdb/arbkcompany/
bad marshal data (unknown type code)
Request Method: GET
Request URL:    http://[2001:6f8:1c00:18b::2]:9000/admin/arbkdb/arbkcompany/
Django Version: 1.3
Exception Type: ValueError
Exception Value:    
bad marshal data (unknown type code)
Exception Location: /usr/lib/python2.7/dist-packages/simplejson/__init__.py in <module>, line 111
Python Executable:  /usr/bin/python
Python Version: 2.7.2
Python Path:    
['/home/ardian/.experiments/arbk',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages/gst-0.10',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
 '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
 '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
 '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
Server time:    Tue, 8 May 2012 16:15:19 -050

追溯

Environment:


Request Method: GET
Request URL: http://[2001:6f8:1c00:18b::2]:9000/admin/arbkdb/arbkcompany/

Django Version: 1.3
Python Version: 2.7.2
Installed Applications:
['admin_tools',
 'admin_tools.theming',
 'admin_tools.menu',
 'admin_tools.dashboard',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'arbkdb',
 'south',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py" in get_response
  89.                     response = middleware_method(request)
File "/usr/lib/pymodules/python2.7/django/contrib/messages/middleware.py" in process_request
  11.         request._messages = default_storage(request)
File "/usr/lib/pymodules/python2.7/django/contrib/messages/storage/__init__.py" in <lambda>
  31. default_storage = lambda request: get_storage(settings.MESSAGE_STORAGE)(request)
File "/usr/lib/pymodules/python2.7/django/contrib/messages/storage/__init__.py" in get_storage
  17.         mod = import_module(module)
File "/usr/lib/pymodules/python2.7/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/usr/lib/pymodules/python2.7/django/contrib/messages/storage/user_messages.py" in <module>
  8. from django.contrib.messages.storage.fallback import FallbackStorage
File "/usr/lib/pymodules/python2.7/django/contrib/messages/storage/fallback.py" in <module>
  2. from django.contrib.messages.storage.cookie import CookieStorage
File "/usr/lib/pymodules/python2.7/django/contrib/messages/storage/cookie.py" in <module>
  5. from django.utils import simplejson as json
File "/usr/lib/pymodules/python2.7/django/utils/simplejson/__init__.py" in <module>
  111.     import simplejson
File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py" in <module>
  111. from decoder import JSONDecoder, JSONDecodeError

Exception Type: ValueError at /admin/arbkdb/arbkcompany/
Exception Value: bad marshal data (unknown type code)

附言。我不知道如何描述为什么会出现这个错误,因为它是在插入大量数据时出现的,我不知道为什么

这是我的模型数据 https://github.com/ardian/arbk/blob/master/arbkdb/models.py

4

2 回答 2

5

看起来不是数据库问题,而是文件损坏消息。删除 *.pyc 和 *.pyo 文件可以解决这个问题。

于 2013-03-15T12:21:55.470 回答
0

通常内存中的操作崩溃会给你这种值错误,错误的编组错误。当电源出现故障并且 appengine 配置文件损坏时,就会发生这种情况。

对我来说,这个问题很常见,我只是直接卸载(删除)并重新安装appengine并重新开始工作。删除 .pyc 文件有时不起作用。

于 2013-04-17T09:32:15.997 回答