question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how about replace pickle with dill? or at least make it an option?

See original GitHub issue

Queue object couldn’t be pickled by pickle, which would raise:

TypeError: can't pickle _thread.lock objects

luckily, dill is API-compatible with pickle, and it could pickle (almost) anything in python, including Queue

so, could you please add an option for that?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piskvorkycommented, Nov 1, 2020

I didn’t know what your comment-less link was supposed to show me.

We do not include patches without a clear motivation. Especially ones with dangerous side effects.

If dill works for you, great – but in case anyone stumbles upon this ticket in the future, please mind the caveats above.

0reactions
mo-hancommented, Nov 1, 2020
def sqlitedict_with_dill():
    import dill
    import sqlitedict
    sqlitedict.dumps = dill.dumps
    sqlitedict.loads = dill.loads
    sqlitedict.PICKLE_PROTOCOL = dill.HIGHEST_PROTOCOL
    return sqlitedict


import queue

sqlitedict = sqlitedict_with_dill()
q = queue.Queue()
q.put(1)
with sqlitedict.SqliteDict('tmp.db', autocommit=True) as sd:
    sd['q'] = q
with sqlitedict.SqliteDict('tmp.db', autocommit=True) as sd:
    print(sd['q'].get() == 1)
Read more comments on GitHub >

github_iconTop Results From Across the Web

9 Dill Substitute Ideas | Save Dinner & the Pickles!
Similar to parsley, chervil offers another mild option to replace dill. Subtle hints of licorice lend themselves to dill dishes, making chervil ...
Read more >
Replace pickle in Python multiprocessing lib - Stack Overflow
Try multiprocess . It's a fork of multiprocessing that uses the dill serializer instead of pickle -- there are no other changes in...
Read more >
What Can You Replace Dill Pickles With? - Sweetish Hill
The National Center for Home Food Preservation says, “For each quart, try 3 heads of fresh dill or 1 to 2 tablespoons dill...
Read more >
How to Make Pickles: Step-by-Step Pickling Guide
1-½ pounds cucumbers or other veggies · 1-cup vinegar. · 1-½ tablespoons salt. · 1 cup water. · ¼ cup sugar – optional...
Read more >
Pickle FAQs - National Center for Home Food Preservation
The best approach is to take dill pickles slices, rinse to remove the salty flavor, and sprinkle with artificial sweetener. Allow these to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found