need helping tracking down weird bug in cPickle

Carl J. Van Arsdall cvanarsdall at mvista.com
Tue Jun 20 13:43:00 EDT 2006


Hey everyone, cPickle is raising an ImportError that I just don't quite 
understand.  Before I paste the code, let me explain the application.  
Basically the part of the application that failed is a function that 
loads a list of objects from a file using cPickle.  This list is a queue 
of requests.  I've done some research and it looks like cPickle tries to 
load some modules as some kind of test.  From what I can tell the module 
that cPickle is trying to load is a concatenation of the module that it 
exists in and part of the string that was sent in the orignal request.

It looks like something where memory is getting overwritten, but I'm not 
really doing anything too fancy, so i'm not sure how to approach this 
problem.  I'm using python2.2.  Does anyone know how I might go about 
trying to troubleshoot something like this?  Is there a good tool or a 
better method of error handling I can use to try and track this down?   
Or is it better to give up troubleshooting and just upgrade to 2.4? 

Here's the code where the error occured:

def initQueue():
  global masterQueue
  try:
    queueFPtr = open("/home/build/bin/resourceManager/queue.rm","rb")
  except IOError:
    raise ResourceError,"Error Opening Queue for Reading"
  except:
    traceback.print_exc()
    raise ResourceError, "Unknown Error Opening Queue"

  try:
    pickledList = cPickle.load(queueFPtr)
  except EOFError:
    masterQueue = [[],[],[]] #empty file, set to empty list for construction
    #there exist 3 blank lists in the master list, these list refer to 
various priorities 0, 1, and 2
    queueFPtr.close()
    return
  except:
    traceback.print_exc()
    raise ResourceError, "Unknown Error loading Queue"
  queueFPtr.close()
  masterQueue = pickledList
  return


Here's the traceback:

Traceback (most recent call last):
  File "/home/build/bin/resourceManager/resourceQueue.py", line 50, in
initQueue
    pickledList = cPickle.load(queueFPtr)
ImportError: No module named resourcepmdb'
Traceback (most recent call last):
  File "./installimage.py", line 443, in ?
    rpmdb = getResource(buildtag,buildid,"dumborpmdb","Installing
installer 
rpms")
  File "/home/build/bin/resourceManager/resourceManager.py", line 39, in 
getResource
    resourceQueue.initQueue()
  File "/home/build/bin/resourceManager/resourceQueue.py", line 58, in
initQueue
    raise ResourceError, "Unknown Error loading Queue"
resourceError.ResourceError: Unknown Error loading Queue






-- 

Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software




More information about the Python-list mailing list