Re: Pickling error in Django using Apache2

2007-04-08 Thread paceman
Thank-you for the demonstration. Makes it much clearer, and sent me back to my 'Python In A Nutshell' book. The function I call to get the datetime, in turn, calls sqlalchemy functions: ** def getHubIndexUpdateDate(file_id): """

Re: Pickling error in Django using Apache2

2007-04-06 Thread Jeremy Dunck
On 4/6/07, paceman <[EMAIL PROTECTED]> wrote: > > I guess what I am beginning to realize is that everytime I call my > mydatetime = getHubIndexUpdateDate(0), I get a new > tz.FixedOffsetTimezone object at , noting the . Well, if using ctime is workable for you, it's certainly a way to avo

Re: Pickling error in Django using Apache2

2007-04-06 Thread paceman
I guess what I am beginning to realize is that everytime I call my mydatetime = getHubIndexUpdateDate(0), I get a new tz.FixedOffsetTimezone object at , noting the . Maybe this is what is messing pickle up since it is complaining that its not the same object. I tried changing the getHubI

Re: Pickling error in Django using Apache2

2007-04-06 Thread Jeremy Dunck
On 4/6/07, paceman <[EMAIL PROTECTED]> wrote: > > Next I tried it with cPickle: ... > >>> mydatetime > datetime.datetime(2007, 3, 3, 10, 51, 36, > tzinfo=) > >>> import cPickle > >>> cPickle.dumps(mydatetime) > "cdatetime\ndatetime\np1\n(S'\\x07\\xd7\\x03\\x03\\n3$\\x00\\x00\ ... I think that as

Re: Pickling error in Django using Apache2

2007-04-06 Thread paceman
Next I tried it with cPickle: >>> from hubDatView import * >>> mydatetime = getHubIndexUpdateDate(0) >>> mydatetime datetime.datetime(2007, 3, 3, 10, 51, 36, tzinfo=) >>> import cPickle >>> cPickle.dumps(mydatetime) "cdatetime\ndatetime\np1\n(S'\\x07\\xd7\\x03\\x03\\n3$\\x00\\x00\ \x00'\ncpsycopg2

Re: Pickling error in Django using Apache2

2007-04-06 Thread paceman
To try an see if the sqlalchemy datetime was causing the problem, I changed this session variable to a string. When I did this, the problem appeared to be gone, indicating that this is the cuprit. Next I called the routine by hand that gives the datetime, and played with it a bit: >>> from hub

Re: Pickling error in Django using Apache2

2007-04-05 Thread paceman
Jeremy, Thank-you for some more good tips. The end of the error message is: > > Can't pickle : it's not the same object as > > psycopg2.tz.FixedOffsetTimezone I am pretty sure there is nothing after that. I will check into the sqlalchemy datetime wrt pickling. The error appears to occur 50% o

Re: Pickling error in Django using Apache2

2007-04-05 Thread Jeremy Dunck
On 4/5/07, paceman <[EMAIL PROTECTED]> wrote: > One is an update_date > that comes from > a postgresql database Yes, the original error reported is: > > "/var/lib/python-support/python2.4/django/contrib/sessions/models.py", > > line 10, in encode pickled = pickle.dumps(session_dict) PicklingError

Re: Pickling error in Django using Apache2

2007-04-05 Thread paceman
Jeremy, the added detail you have provided caused me to go back and look at my code to see if I am doing what you are suggesting. It is not obvious to me. I believe I add two things to request.session. One is an update_date that comes from a postgresql database and the other is a status text str

Re: Pickling error in Django using Apache2

2007-04-05 Thread Jeremy Dunck
On 4/5/07, Mae <[EMAIL PROTECTED]> wrote: ... > We also have a theory that it's adding model objects to sessions that > causes our problem because model objects are created dynamically by > their meta classes. Am I close? I don't think so, since I've successfully serialized models before. I'm pr

Re: Pickling error in Django using Apache2

2007-04-05 Thread Jeremy Dunck
On 4/5/07, Mae <[EMAIL PROTECTED]> wrote: ... > Is what I'm doing "monkey patching"? What does "monkey patching" > mean? How am I making it difficult for the pickling functions to > figure out my "type name"? What should I do to fix it? > No, but if your code is that simple and still fails, yo

Re: Pickling error in Django using Apache2

2007-04-05 Thread Jeremy Dunck
On 4/5/07, Mae <[EMAIL PROTECTED]> wrote: > > Wow, what luck! I've been having a sporadic "" problem, and I've just > resigned myself to spending today to try to debug it. Searched the > group for exact error, found nothing, refreshed, and saw this post in > top slot! Kismet. (The error is "Ty

Re: Pickling error in Django using Apache2

2007-04-05 Thread Mae
Aha. I fear I'll be accused of mumbling to myself, but I think I understand now that what you meant by your x.Y = Y example. We also have a theory that it's adding model objects to sessions that causes our problem because model objects are created dynamically by their meta classes. Am I close?

Re: Pickling error in Django using Apache2

2007-04-05 Thread Mae
Er, that would be "a sporadic "TypeError: can't pickle function objects" problem" :). Forgot to paste. On Apr 5, 12:08 pm, "Mae" <[EMAIL PROTECTED]> wrote: > Wow, what luck! I've been having a sporadic "" problem, and I've just > resigned myself to spending today to try to debug it. Searched t

Re: Pickling error in Django using Apache2

2007-04-05 Thread Mae
Wow, what luck! I've been having a sporadic "" problem, and I've just resigned myself to spending today to try to debug it. Searched the group for exact error, found nothing, refreshed, and saw this post in top slot! Kismet. Jeremy, I'm not sure I understood your last post well enough. Could

Re: Pickling error in Django using Apache2

2007-04-05 Thread Jeremy Dunck
On 4/5/07, paceman <[EMAIL PROTECTED]> wrote: ... > I wonder if apache prefork reloads modules (maybe psycopg2) that I am > not aware of and that causes the pickling of the object not to work? This would also occur if you were monkey patching classes, I think. Do you have anything that does some

Re: Pickling error in Django using Apache2

2007-04-05 Thread paceman
Thank-you for your reply. It gives me more food for thought. I still do not know why it works perfectly in the django development mode, and works half the time with apache2 prefork, and works all the time with apache2 mpm-worker. I wonder if apache prefork reloads modules (maybe psycopg2) that I

Re: Pickling error in Django using Apache2

2007-04-04 Thread Jeremy Dunck
On 4/4/07, paceman <[EMAIL PROTECTED]> wrote: ... > > > "/var/lib/python-support/python2.4/django/contrib/sessions/models.py", > > > line 10, in encode pickled = pickle.dumps(session_dict) PicklingError: > > > Can't pickle : it's not the same object as > > > psycopg2.tz.FixedOffsetTimezone > *