pickle Questions

1

I want to use multiprocessing module with sqlAlchemy in my custom class. Here is the code: from sqlalchemy import create_engine engine = create_engine(f'mysql+pymysql://a:b@localhost:3306/', serv...
Pennyweight asked 20/9, 2019 at 6:33

7

Solved

I have created a small python script of mine. I saved the pickle file on Linux and then used it on windows and then again used it back on Linux but now that file is not working on Linux but it is w...
Tibbetts asked 4/12, 2009 at 20:39

0

While investigating the memory use of an application that exchanges message through PyZMQ using tracemalloc, I noticed a weird behavior of pickling and unpickling enums: memory looks like it is lea...
Diffusion asked 28/6 at 12:40

3

I would like to save the state of itertools.product() after my program quits. Is it possible to do this with pickling? What I am planning to do is to generate permutations and if the process is int...
Solemnize asked 9/11, 2014 at 18:27

3

I'm working on a social media sentiment analysis for a class. I have gotten all of the tweets about the Kentucky Derby for a 2 month period saved into pkl files. My question is: how do I get all o...
Fustanella asked 21/10, 2016 at 15:45

5

Solved

From the Python documentation: By default, the pickle data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently compress pickled ...
Gyrostatic asked 18/9, 2019 at 0:14

1

I have a 25GB pickle of a dictionary of numpy arrays. The dictionary looks like the following: 668,956 key-value pairs. The keys are strings. Example key: "109c3708-3b0c-4868-a647-b9feb306c88...
Abmho asked 3/12, 2023 at 22:25

3

Solved

I would like to serialize on machine A and deserialize on machine B a python lambda. There are a couple of obvious problems with that: the pickle module does not serialize or deserialize code. It...
Vena asked 9/8, 2012 at 7:2

6

Solved

In Python 3.7.5, ubuntu 18.04, pickle read gives error, pickle version 4 Sample code: import pickle as pkl file = open("sample.pkl", "rb") data = pkl.load(file) Error: UnpicklingError T...
Cray asked 20/11, 2019 at 8:23

1

I got this error loading embeddings with FAISS: The de-serialization relies loading a pickle file. Pickle files can be modified to deliver a malicious payload that results in execution of ar...
Cheops asked 7/3 at 9:35

5

Solved

I have a pkl file from MNIST dataset, which consists of handwritten digit images. I'd like to take a look at each of those digit images, so I need to unpack the pkl file. Is there a way to unpack/u...
Poachy asked 23/7, 2014 at 8:58

5

Solved

I created some data and stored it several times like this: with open('filename', 'a') as f: pickle.dump(data, f) Every time the size of file increased, but when I open file with open('filename', ...
Kreit asked 28/1, 2016 at 17:22

7

Solved

My question is similar to this. I also use pickle to save & load model. I meet the below error during pickle.load( ) from sklearn.preprocessing import StandardScaler # SAVE scaler = StandardS...
Scuff asked 19/2, 2020 at 16:36

8

Solved

I'm setting up a script and I need to use some functions from fast-ai package. The fact is that I'm on Windows and when I define my paths, the function from fast-ai named load_learner can't load th...
Stickweed asked 31/7, 2019 at 8:33

9

Solved

I have a class that serves players in a game, creates them and other things. I need to save these player objects in a file to use it later. I've tried the pickle module but I don't know how to sa...
Outlying asked 21/12, 2013 at 7:47

16

This is the error I got today at <a href"http://filmaster.com">filmaster.com: PicklingError: Can't pickle <class 'decimal.Decimal'>: it's not the same object as decimal.Decim...
Nitrobacteria asked 11/9, 2009 at 19:13

4

Solved

I have an sklearn k-means model. I am training the model and saving it in a pickle file so I can deploy it later using azure ml library. The model that I am training uses a custom Feature Encoder c...
Breath asked 4/12, 2019 at 12:37

3

Solved

How do I create a pickleable file from a PIL Image object such that you could save those images as a single pickle file then maybe upload to another computer such as a server running PIL and unpick...
Incurve asked 12/4, 2012 at 5:49

1

I have created a dataset mapping images to their labels for a ml project. I want to save the dataset on a script and load it in another one to save time every time I rerun the code for the model. T...
Descender asked 28/2, 2021 at 1:39

6

Solved

I am trying to pickle a namedtuple: from collections import namedtuple import cPickle class Foo: Bar = namedtuple('Bar', ['x', 'y']) def baz(self): s = set() s.add(Foo.Bar(x=2, y=3)) print...
Trip asked 13/1, 2011 at 5:14

8

I'm trying to serve a pytorch model in a flask app. This code was working when I ran this on a jupyter notebook earlier but now I'm running this within a virtual env and apparently it can't get att...
Toreutics asked 3/4, 2019 at 6:50

5

Solved

I used Metaflow to load a Dataframe. It was successfully unpickled from the artifact store, but when I try to view its index using df.index, I get an error that says ModuleNotFoundError: No module ...
Buatti asked 6/4, 2023 at 19:52

13

Solved

I am getting an interesting error while trying to use Unpickler.load(), here is the source code: open(target, 'a').close() scores = {}; with open(target, "rb") as file: unpickler = pickle.Unpickl...
Simplehearted asked 16/7, 2014 at 22:35

1

Solved

According to this SO answer, when a multiprocessing.Queue is passed to a child process, what is actually sent is a file descriptor (or handle) obtained from pipe, instead of pickling the Queue obje...
Sacculus asked 28/10, 2023 at 16:11

2

I'm trying to run this code that uses networkx to read a graph pickle file. def read_graph(self, path=f'./dblp_graph.gpickle'): self.g = networkx.read_gpickle(path=path) return self.g When I run...
Menagerie asked 13/4, 2023 at 2:48

© 2022 - 2024 — McMap. All rights reserved.