Files
v2realbot/testy/picklequeue.py
David Brazda dc4c10a4a3 other changes
2023-11-15 09:02:15 +01:00

25 lines
542 B
Python

import queue
import msgpack
# Creating the original queue
original_queue = queue.Queue()
new_queue = queue.Queue()
# Adding elements to the original queue
original_queue.put(5)
original_queue.put(10)
original_queue.put(15)
# Pickling the queue
pickled_queue = msgpack.packb(original_queue)
# Unpickling the queue
unpickled_queue = msgpack.unpackb(pickled_queue)
# Pickling the queue
new_queue.queue = unpickled_queue.queue
print(new_queue)
# Checking the contents of the new queue
while not new_queue.empty():
print(new_queue.get())