Charles,
by your own admission, you deleted your pkl file,
And your code doesn't write that pkl file (pickle.dumps(...) doesn't
write a file it creates a new string and at no point will it write to
the file :
What you need is this :
import pickle
number=2
my_pickled_
On 4/19/2023 12:14 PM, charles wiewiora wrote:
Hello,
I am experincing problems with the pickle moducle
the folowing code was working before,
import pickle
number=2
my_pickeld_object=pickle.dumps(number)
print("this is my pickled object",{my_pickeld_object},)
with open('file.pkl', 'rb') as file:
Hello,
I am experincing problems with the pickle moducle
the folowing code was working before,
import pickle
number=2
my_pickeld_object=pickle.dumps(number)
print("this is my pickled object",{my_pickeld_object},)
with open('file.pkl', 'rb') as file:
number=pickle.load(file)
my_unpickeled_objec
See more details in my forum post:
http://www.python-forum.org/pythonforum/viewtopic.php?f=18&t=26724
I'm trying to pickle a bunch of functions (mostly built-in) and pickle keeps
giving me errors. I have no Ellipsis in my data at all, and for some reason,
pickle seems to think I do.
Here is a
gerardob a écrit :
I have a problem using Pickle inside a class object.
The following code works:
m2 = markov_model.MarkovModel()
m2 = pickle.load(open("prueba", 'rb'))
Given the second line, the first is totally useless.
print m2.n
However, if I create the following method inside markov_
el.MarkovModel()
m2.load_model_from_file("prueba")
print m2.n
it says that 'MarkovModel' object has no attribute 'n'. If the printing of
'n' i put it inside (at the end) of the method load_model_from_file as
'print self.n' it works.
How can i solve