Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6843577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:15:42+00:00 2026-05-27T00:15:42+00:00

I am pickling Python Objects in Django and saving it in MySQL db. So

  • 0

I am pickling Python Objects in Django and saving it in MySQL db.
So far i have followed these simple rules:

  1. cPickle.dumps(object) #to convert python object to pickled object

  2. cPickle.loads(pickled_object) # to load back the python object from pickled object

  3. My Django Model Field is Text Field

  4. MySQL db field Type is longblob Attributes binary

  5. MySQL db encoding is utf8_unicode_ci

Unfortunately i am getting following error while loading back python object.

Type Error: ('an integer is required', <type 'datetime.date'>, ('x07xb6x0bx06',))

It seems to me by looking on error value x07xb6x0bx06 this is an encoding problem.
Did i miss some important step?? Can any one help me to solve this problem??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:15:43+00:00Added an answer on May 27, 2026 at 12:15 am

    If you are trying to store the output of cPickle.dumps in a VARCHAR column, then your issue is that you are trying to store a byte-string in a character column. The fix in that case is to encode your object as unicode(base64.encode(cPickle.dumps(myobject))) and then store it.

    Alternatively:

    object2varchar = lambda obj: unicode(base64.encode(cPickle.dumps(obj)))
    store(object2varchar([1, 'foo']))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that these methods are for pickling/unpickling and have no relation to the
I understood that Python pickling is a way to 'store' a Python Object in
In order to do object picking in OpenGL, do I really have to render
I have a problem with python-config --ldflags on OS X 10.6.2. Using my non-system
I'm trying to manually set an object in the Django cache API but it
I have a simple webservice that I need to scale up substantially. I'm trying
I have never used Python before, most of my programming has been in MATLAB
I have a class Book : from django.db import models from users.models import User
I have a list of ~1.7 million token objects, along with a list of
I have been programming in Python, PHP, Java and C for a couple or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.