On May 23, 7:00 pm, alex23 <[EMAIL PROTECTED]> wrote: > On May 24, 7:14 am, nayden <[EMAIL PROTECTED]> 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
It's not a string it's a cStringIO.StringIO, even though his variable name is confusing. nayden: 'str' is a built-in variable that is the string type. Try this for different values of x: type(x) is str str(x) When you override it, it may be confusing down the line. I'd suggest installing pychecker, which will help you catch errors like this: http://pychecker.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list