tnm / qr

Queues, stacks, deques, and priority queues with Redis in Python
225 stars 42 forks source link

PriorityQueue loadfname does not appear to work #9

Open ghost opened 11 years ago

ghost commented 11 years ago

I am not able to reload the content of the PriorityQueue from file using the following:

from qr import PriorityQueue filename = "test.data"

pr = PriorityQueue('test')

pr.push('one', 1) pr.push('two', 2) pr.push('end', 3)

print pr.elements()

pr.dumpfname(filename, True)

print pr.elements()

print file(filename).read()

pr.loadfname(filename)

print len(pr.elements())

When I run the script I see the following:

python test_pq.py ['one', 'two', 'end'] [] S'o' .S't' .S'e' . 0

It appear that it has not possible to reload the content from the file. Not sure if the issue is in the serializing the data to read to file or in th read back from file.