Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

python - "Bad marshal data" Django development server error

Got this error while insterting data into my MySQL database

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

Trackback

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)

Ps. I am not sure how to describe why it came to this error because it appeard while inserting a lot of data and I don't know why

This is my model data https://github.com/ardian/arbk/blob/master/arbkdb/models.py

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like is not a database problem but a corrupted files message. Removing *.pyc and *.pyo files solves this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...