Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > bug in my code?

Thread Tools

bug in my code?

Duncan Smith
Posts: n/a
Greetings. I am struggling to track down what I presume is a bug in my
code. The trouble is that it only raises its head occasionally. I have
managed to prune the code to the following:
import cPickle

def test2(iterations):
for i in range(iterations):
f = file('C:\\Python22\\(2, 2, 2, 3, 4).shu', 'r')
dependencies, nodes = cPickle.load(f)
except IOError:

Calling the function with a suitable argument (say, 100) doesn't usually
pose a problem. The file is opened OK and the data unpickled. But
occasionally (or usually if I call the function with 1000 as argument) I get
the all too common, on Windows,

'The instruction at {some memory address} referenced memory at {some other
(and on one occasion the same) memory address}. The memory could not be

I just tried to run the function in the interactive window and got the
following traceback.

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "", line 9, in test2
dependencies, nodes = cPickle.load(f)
cPickle.UnpicklingError: invalid load key, 'a'.

where the 'a' has a grave accent over it.

I'm guessing that the previous crashes have corrupted the file? Is there
any reason why my code should have caused the crashes, or is this just
Windows 2000? The crashes don't seem to be totally random as they always
occur in this section of code. BTW I am using Python 2.2.2, and I had the
crashes in PythonWin, IDLE and the interactive window. TIA.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM