Storing objects in relational database

alex23 wuwei23 at gmail.com
Fri May 23 22:00:20 EDT 2008


On May 24, 7:14 am, nayden <nay... at gmail.com> wrote:
> the execution fails just after the print statement, and I am not quite
> sure why is that.

It's often helpful to include the traceback, or at the very least the
last 3-4 lines of it, as it helps everyone work out the issue you're
having.

If you're not sure which line in a function is causing the issue, try
commenting out all but the first, run-and-test, re-add the next, run-
and-test etc

But the error is most likely this line:
>     i = cPickle.load(str)

cPickle.load unpickles from a file, but here you're handing it a
string. You want cPickle.loads.

At the interpreter, you can always quickly check these out by looking
up the docstring via 'help(cPickle.loads)' (or 'cPickle.loads?' if
you're using iPythhon).

- alex23



More information about the Python-list mailing list