En Tue, 21 Oct 2008 10:31:58 -0200, Митя <[EMAIL PROTECTED]> escribió:
Thank you! I have already implemented custom load/save operations
without pickle. And they work fine on atexit.
Just for information: pickle.dump worked OK when called manually, but
being called by atexit it produeced the ab
Thank you! I have already implemented custom load/save operations
without pickle. And they work fine on atexit.
Just for information: pickle.dump worked OK when called manually, but
being called by atexit it produeced the above described error. I don't
know why.
On Oct 21, 7:54 am, "Gabriel Genell
En Mon, 20 Oct 2008 10:01:07 -0200, Митя <[EMAIL PROTECTED]> escribió:
Thank you for your answers!
my g_register is a global object, and it lives all the program's
lifetime, so 'with' is not appliable. Am I right?
Why not? You could use a with statement (or try/finally) around your main
ent
Thank you for your answers!
my g_register is a global object, and it lives all the program's
lifetime, so 'with' is not appliable. Am I right?
I tried to use atexit and wrote following:
class _Register(object):
def dump(self):
class Registerable(object):
g_register = _
Thanks for your answers!
my g_register is a global register, wich contains all my objects and
lives all the program lifetime. So 'with' is not appliable. Am I
right?
But using atexit sounds to be a good solution
On Oct 20, 1:58 pm, Michele Simionato <[EMAIL PROTECTED]>
wrote:
> On Oct 20, 10:12š
On Oct 20, 10:12 am, Митя <[EMAIL PROTECTED]> wrote:
> But when g_register is being destroyed, dump seems to be already dead,
> so I get:
>
> Exception exceptions.TypeError: "'NoneType' object is not callable" in
> at 0x835a74c>> ignored
>
> can I somehow save my data from destructor?
The best th
Митя <[EMAIL PROTECTED]> writes:
> I have a class which I want to save it's data automatically on disc,
> when it's destroyed. I have following code:
>
> from cPickle import dump
>
> class __Register(object):
> def __init__(self):
> self.dict = {}
> def __del__(self):
> fh
Митя wrote:
I have a class which I want to save it's data automatically on disc,
when it's destroyed. I have following code:
from cPickle import dump
class __Register(object):
def __init__(self):
self.dict = {}
def __del__(self):
fh = open('aaa', 'w')
dump(self.d
On Mon, 20 Oct 2008 01:12:06 -0700, Митя wrote:
> I have a class which I want to save it's data automatically on disc,
> when it's destroyed. I have following code:
>
> from cPickle import dump
>
> class __Register(object):
> def __init__(self):
> self.dict = {}
> def __del__(sel
I have a class which I want to save it's data automatically on disc,
when it's destroyed. I have following code:
from cPickle import dump
class __Register(object):
def __init__(self):
self.dict = {}
def __del__(self):
fh = open('aaa', 'w')
dump(self.dict, fh)
10 matches
Mail list logo