Re: cPickle fails on manually compiled and executed Python function

2017-07-18 Thread Jan Gosmann
On 07/18/2017 01:07 AM, dieter wrote: "Jan Gosmann" writes: [...] fn = load_pyfile('fn.py')['fn'] [...] "pickle" (and "cpickle") are serializing functions as so called "global"s, i.e. as a module reference together with a name. T

Re: cPickle fails on manually compiled and executed Python function

2017-07-17 Thread dieter
"Jan Gosmann" writes: > today I came across some weird behaviour (a bug?) in Python 2.7.13 (on > Linux) with the cPickle module. The pickle module works and so does > the pickle module in Python 3. > > I have a file fn.py with a minimal function definition: >

cPickle fails on manually compiled and executed Python function

2017-07-17 Thread Jan Gosmann
Hi, today I came across some weird behaviour (a bug?) in Python 2.7.13 (on Linux) with the cPickle module. The pickle module works and so does the pickle module in Python 3. I have a file fn.py with a minimal function definition: ``` def fn(): pass ``` The actual code that I run is in

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-25 Thread Rotwang
On 24/06/2012 00:17, Steven D'Aprano wrote: On Sat, 23 Jun 2012 19:14:43 +0100, Rotwang wrote: The problem is that if the object was pickled by the module run as a script and then unpickled by the imported module, the unpickler looks in __main__ rather than mymodule for the object's class, and

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2012 19:14:43 +0100, Rotwang wrote: > The problem is that if the object was > pickled by the module run as a script and then unpickled by the imported > module, the unpickler looks in __main__ rather than mymodule for the > object's class, and doesn't find it. Possibly the solutio

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
On 23/06/2012 18:31, Dave Angel wrote: On 06/23/2012 12:13 PM, Peter Otten wrote: Rotwang wrote: Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, wh

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
On 23/06/2012 17:13, Peter Otten wrote: Rotwang wrote: Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, whereas sometimes I want to run it as a script

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Dave Angel
On 06/23/2012 12:13 PM, Peter Otten wrote: > Rotwang wrote: > >> Hi all, I have a module that saves and loads data using cPickle, and >> I've encountered a problem. Sometimes I want to import the module and >> use it in the interactive Python interpreter, whereas somet

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Peter Otten
Rotwang wrote: > Hi all, I have a module that saves and loads data using cPickle, and > I've encountered a problem. Sometimes I want to import the module and > use it in the interactive Python interpreter, whereas sometimes I want > to run it as a script. But objects that hav

cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, whereas sometimes I want to run it as a script. But objects that have been pickled by running the module

RE: Error 'module' object has no attribute "_extension_registry" when cPickle is imported from an installed Python 2.7.1

2011-09-27 Thread Wong Wah Meng-R32813
[mailto:python-list-bounces+wahmeng=freescale@python.org] On Behalf Of Gabriel Genellina Sent: Wednesday, September 28, 2011 7:53 AM To: python-list@python.org Subject: Re: Error 'module' object has no attribute "_extension_registry" when cPickle is imported from an installed

Re: Error 'module' object has no attribute "_extension_registry" when cPickle is imported from an installed Python 2.7.1

2011-09-27 Thread Gabriel Genellina
En Tue, 27 Sep 2011 06:08:54 -0300, Wong Wah Meng-R32813 escribió: Hello all, I encounter this issue whereby I am not able to load cPickle module into the python I newly built. There is no issue when I load it right from the folder where the python executable and libpython2.7.so is

Error 'module' object has no attribute "_extension_registry" when cPickle is imported from an installed Python 2.7.1

2011-09-27 Thread Wong Wah Meng-R32813
Hello all, I encounter this issue whereby I am not able to load cPickle module into the python I newly built. There is no issue when I load it right from the folder where the python executable and libpython2.7.so is built. However, it gives me this error when I load the same module using the

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual error mess

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual error mess

Re: cPickle -> invalid signature

2011-05-17 Thread Neal Becker
Gabriel Genellina wrote: > En Tue, 17 May 2011 08:41:41 -0300, Neal Becker > escribió: > >> What does it mean when cPickle.load says: >> RuntimeError: invalid signature >> >> Is binary format not portable? > > Are you sure that's the actual error message? > I cannot find such message anywhere i

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual error message? I cannot find such message anywhere in the sources. The pickle format is quite po

cPickle -> invalid signature

2011-05-17 Thread Neal Becker
What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? -- http://mail.python.org/mailman/listinfo/python-list

Where's the bug? (cPickle/thread edition) (was Re: How to optimize and monitor garbage collection?)

2010-11-20 Thread Aahz
s more than thirty seconds on the server). Nevertheless, I think it's also arguably a bug that dumps() doesn't release the GIL. (cPickle.dump() *does* release the GIL.) (Fortunately, we're savvy enough that it's easy for us to just make a local copy of cPickle that releases the

Re: cPickle segfault with nested dicts in threaded env

2010-09-09 Thread Kenneth Dombrowski
On Wed, Sep 8, 2010 at 6:55 PM, Paul Rubin wrote: > Carl Banks writes: >> Since Python 2.7 is released, Python 2.5 is no longer accepting bug >> fixes, only security fixes.  So be aware. > > Segfaults should be treated as security holes unless there's convincing > reasons that no exploit is possi

Re: cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Aahz
In article , Thomas Jollans wrote: > >Also, Python 2.5 is frightfully old. [...] "Frightfully"??? I'm sure plenty of people are still using Python 2.3 in production environments (certainly my last job did as of 1.5 years ago, and I would be mildly surprised if they upgraded by now). -- Aahz (

Re: cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Paul Rubin
Carl Banks writes: > Since Python 2.7 is released, Python 2.5 is no longer accepting bug > fixes, only security fixes. So be aware. Segfaults should be treated as security holes unless there's convincing reasons that no exploit is possible. So the bug should be reported against 2.5 as well as l

Re: cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Carl Banks
On Sep 8, 11:58 am, Kenneth Dombrowski wrote: > Hi all, > > Before creating an issue @ bugs.python.org I wanted to run the > following by everyone > > We are having a difficult time with what looks like a cPickle issue > when given a data structure containing >15 nested

Re: cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Thomas Jollans
On Wednesday 08 September 2010, it occurred to Kenneth Dombrowski to exclaim: > Environment is FreeBSD 8, Python 2.5.5 Which architecture? Also, Python 2.5 is frightfully old. There's not really any problem with still using it, but nobody's maintaining it upstream, so don't bother reporting a b

cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Kenneth Dombrowski
Hi all, Before creating an issue @ bugs.python.org I wanted to run the following by everyone We are having a difficult time with what looks like a cPickle issue when given a data structure containing >15 nested dictionaries, but only when threading is involved Environment is FreeBSD 8, Pyt

Re: cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
On 3/08/2010 17:01, Peter Otten wrote: > You can only pickle instances of classes that are reachable by the import > system as only the qualified name of the class is stored, not the bytecode > to generate it. Move your class out of the function into the global module > scope and you should be

Re: cPickle error when caching data

2010-08-03 Thread Peter Otten
ion: > > def calc_stats_topcallers(): > stats_all = {} > # cPickle doesn't like this class > class Stats(object): > def __init__(self): > self.calls = None > self.user = None You can only pickle instances of classes that are reachable

cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
Stats failed Stats is a class i use to hold a couple of values, a string (user) and a number (calls), that are then used in a template. These are pickable, right? The data i want to pickle is the return value of this function: def calc_stats_topcallers(): stats_all = {} # cPickle doesn't

Re: writing large dictionaries to file using cPickle

2009-04-26 Thread repi
Hello, I'm having the same problem. I'm creating two dictionaries with about 700,000 to 1,600,000 keys each, each key pointing to a smaller structure of embedded dictionaries. On a 8 x 3.0GHz Xeon Mac Pro with 17GB of RAM, cPickle is excruciatingly slow. Moreover, it crashes with me

Re: cPickle and subclassing lists?

2009-04-17 Thread Carl Banks
On Apr 17, 10:13 am, Reckoner wrote: > I have a large class that is a child of list. I need to pickle it, but > it's not working. For example, I have reduced it to the following: > > class Mylist(list): >     def __init__(self,x=[]): >         list.__init__(self,x) > > and I cannot even get this t

Re: cPickle and subclassing lists?

2009-04-17 Thread Reckoner
On Apr 17, 11:16 am, Piet van Oostrum wrote: > > Reckoner (R) wrote: > >R> I have a large class that is a child of list. I need to pickle it, but > >R> it's not working. For example, I have reduced it to the following: > >R> class Mylist(list): > >R> def __init__(self,x=[]): > >R> l

Re: cPickle and subclassing lists?

2009-04-17 Thread Piet van Oostrum
> Reckoner (R) wrote: >R> I have a large class that is a child of list. I need to pickle it, but >R> it's not working. For example, I have reduced it to the following: >R> class Mylist(list): >R> def __init__(self,x=[]): >R> list.__init__(self,x) >R> and I cannot even get this to pi

Re: cPickle and subclassing lists?

2009-04-17 Thread Peter Otten
't pickle : attribute lookup >> > __main__.p fa >> > iled >> >> > I'm using python 2.5 on win32. >> >> > any help appreciated. >> >> This error occurs when you try to pickle a class that cannot be found by >> its name: >>

Re: cPickle and subclassing lists?

2009-04-17 Thread Reckoner
; > I'm using python 2.5 on win32. > > > any help appreciated. > > This error occurs when you try to pickle a class that cannot be found by its > name: > > >>> from cPickle import dumps > >>> class p: pass > ... > >>> a = p > >&

Re: cPickle and subclassing lists?

2009-04-17 Thread Peter Otten
his to pickle right. > >>> w=Mylist([1,2,3]) >>> dumps(w) > > PicklingError: Can't pickle : attribute lookup > __main__.p fa > iled > > > I'm using python 2.5 on win32. > > any help appreciated. This error occurs when you try to pick

cPickle and subclassing lists?

2009-04-17 Thread Reckoner
I have a large class that is a child of list. I need to pickle it, but it's not working. For example, I have reduced it to the following: class Mylist(list): def __init__(self,x=[]): list.__init__(self,x) and I cannot even get this to pickle right. >> w=Mylist([1,2,3]) >> dumps(w) P

Re: Using cPickle

2009-02-25 Thread mmcclaf
Thanks! All fixed! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using cPickle

2009-02-06 Thread MRAB
mmcclaf wrote: On Feb 6, 3:09 pm, MRAB wrote: mmcclaf wrote: On Feb 6, 10:25 am, Steve Holden wrote: mmcclaf wrote: Hi there, I have to make a small database using cPickle. I'm having troubles trying to read in the information if it's more than one line. I'm pretty sure i

Re: Using cPickle

2009-02-06 Thread mmcclaf
On Feb 6, 3:09 pm, MRAB wrote: > mmcclaf wrote: > > On Feb 6, 10:25 am, Steve Holden wrote: > >> mmcclaf wrote: > >>> Hi there, > >>> I have to make a small database using cPickle. I'm having troubles > >>> trying to read in the informa

Re: Using cPickle

2009-02-06 Thread MRAB
mmcclaf wrote: On Feb 6, 10:25 am, Steve Holden wrote: mmcclaf wrote: Hi there, I have to make a small database using cPickle. I'm having troubles trying to read in the information if it's more than one line. I'm pretty sure it's in the line "for line in stuff

Re: Using cPickle

2009-02-06 Thread mmcclaf
On Feb 6, 10:25 am, Steve Holden wrote: > mmcclaf wrote: > > Hi there, > > > I have to make a small database using cPickle. I'm having troubles > > trying to read in the information if it's more than one line. I'm > > pretty sure it's in the li

Re: Using cPickle

2009-02-06 Thread Steve Holden
mmcclaf wrote: > Hi there, > > I have to make a small database using cPickle. I'm having troubles > trying to read in the information if it's more than one line. I'm > pretty sure it's in the line "for line in stuff:" Can anyone help me > out

Using cPickle

2009-02-06 Thread mmcclaf
Hi there, I have to make a small database using cPickle. I'm having troubles trying to read in the information if it's more than one line. I'm pretty sure it's in the line "for line in stuff:" Can anyone help me out? Basically the end result is wanting it to look som

Re: writing large dictionaries to file using cPickle

2009-01-30 Thread Aaron Brady
t write-once, read-many, it's about > > the same. > > > You said you have a million dictionaries.  Even if each took only one > > byte, you would still have a million bytes.  Do you expect a faster I/ > > O time than the time it takes to write a million bytes

Re: writing large dictionaries to file using cPickle

2009-01-30 Thread perfreem
ave a million bytes.  Do you expect a faster I/ > O time than the time it takes to write a million bytes? > > I want to agree with John's worry about RAM, unless you have several+ > GB, as you say.  You are not dealing with small numbers. in my case, i just write the pickle file on

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Gabriel Genellina
quires the Pickler instance to remember every object pickled so far -- setting the "fast" attribute to a true value bypasses this check. Before using this, you must be positively sure that your objects don't contain circular references -- else pickling will never finish. py> from cP

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread John Machin
...], > > >                 key2: [...]} > > > > in total there are about 10 to 15 million lists if we concatenate > > > together all the values of every key in 'mydict'. mydict is a > > > structure that represents data in a very large file (ab

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Aaron Brady
On Jan 28, 4:43 pm, perfr...@gmail.com wrote: > On Jan 28, 5:14 pm, John Machin wrote: > > > > > On Jan 29, 3:13 am, perfr...@gmail.com wrote: > > > > hello all, > > > > i have a large dictionary which contains about 10 keys, each key has a > > > value which is a list containing about 1 to 5 milli

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread perfreem
to 15 million lists if we concatenate > > together all the values of every key in 'mydict'. mydict is a > > structure that represents data in a very large file (about 800 > > megabytes). > > > what is the fastest way to pickle 'mydict' into a

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread John Machin
27;. mydict is a > structure that represents data in a very large file (about 800 > megabytes). > > what is the fastest way to pickle 'mydict' into a file? right now i am > experiencing a lot of difficulties with cPickle when using it like > this: > > from cPi

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Aaron Brady
On Jan 28, 10:13 am, perfr...@gmail.com wrote: > hello all, > > i have a large dictionary which contains about 10 keys, each key has a > value which is a list containing about 1 to 5 million (small) > dictionaries. for example, snip > but this takes just as long... any ideas ? is there a different

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Christian Heimes
perfr...@gmail.com schrieb: > but this takes just as long... any ideas ? is there a different module > i could use that's more suitable for large dictionaries ? > thank you very much. Have a look at ZODB. -- http://mail.python.org/mailman/listinfo/python-list

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread perfreem
On Jan 28, 11:32 am, pyt...@bdurham.com wrote: > Hi, > > Change: > > pickle.dump(mydict, pfile) > > to: > > pickle.dump(mydict, pfile, -1 ) > > I think you will see a big difference in performance and also a much > smaller file on disk. > > BTW: What type of application are you developing that crea

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread python
Hi, Change: pickle.dump(mydict, pfile) to: pickle.dump(mydict, pfile, -1 ) I think you will see a big difference in performance and also a much smaller file on disk. BTW: What type of application are you developing that creates so many dictionaries? Sounds interesting. Malcolm -- http://mail

writing large dictionaries to file using cPickle

2009-01-28 Thread perfreem
at is the fastest way to pickle 'mydict' into a file? right now i am experiencing a lot of difficulties with cPickle when using it like this: from cPickle import pickle pfile = open(my_file, 'w') pickle.dump(mydict, pfile) pfile.close() this creates extremely large files (~ 300 MB) thou

Re: cPickle vs pickle discrepancy

2009-01-08 Thread Zac Burns
8, 12:27 pm, "Zac Burns" wrote: >> Thanks for your patience waiting for me to isolate the problem. >> >> | Package >> --__init__.py ->empty >> --Package.py ->empty >> --Module.py >> import cPickle >> class C(object): >

Re: cPickle vs pickle discrepancy

2009-01-08 Thread Carl Banks
On Jan 8, 12:27 pm, "Zac Burns" wrote: > Thanks for your patience waiting for me to isolate the problem. > > | Package > --__init__.py ->empty > --Package.py ->empty > --Module.py >      import cPickle >      class C(object): >         pass >    

Re: cPickle vs pickle discrepancy

2009-01-08 Thread Zac Burns
Thanks for your patience waiting for me to isolate the problem. | Package --__init__.py ->empty --Package.py ->empty --Module.py import cPickle class C(object): pass def fail(): return cPickle.dumps(C(), -1) import Package.Module Package.Module.fail() The f

Re: cPickle vs pickle discrepancy

2009-01-06 Thread Gabriel Genellina
En Mon, 05 Jan 2009 23:04:30 -0200, Zac Burns escribió: I have a module that attempts to pickle classes defined in that module. I get an error of the form: PicklingError: Can't pickle : import of module Module.SubModule failed when using cPickle (protocol -1, python version 2.5.1).

cPickle vs pickle discrepancy

2009-01-05 Thread Zac Burns
Greetings, I have a module that attempts to pickle classes defined in that module. I get an error of the form: PicklingError: Can't pickle : import of module Module.SubModule failed when using cPickle (protocol -1, python version 2.5.1). The module has already been imported and

Re: Problem with cPickle and cElementTree

2008-10-09 Thread Stefan Behnel
Barry wrote: > I recently tried switching from ElementTree to cElementTree. My > application parses a collection of large XML files and creates indexes > based on certain attributes. This entire collection is saved as an > instance of my Database class. Using ElementTree and

Problem with cPickle and cElementTree

2008-10-09 Thread Barry
I recently tried switching from ElementTree to cElementTree. My application parses a collection of large XML files and creates indexes based on certain attributes. This entire collection is saved as an instance of my Database class. Using ElementTree and cPickle has allowed me to save these

hi can someone help me i would like to run this program 3 times and would like to append the cPickle file as a high score table

2008-10-09 Thread garywood
hi, Can someone help me i would like to run this program 3 times or more and would like to append the cPickle file as a high score table keeping my top scores. Right now it only records the last score thanks. # Trivia Challenge # Trivia game that reads a plain text file def open_file

Re: cPickle

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 13:08:59 Gerhard Häring, vous avez écrit : > gopal mishra wrote: > > I have 3 objects and want to save in one pickle file. > > > > I used cPickle to dump 3 objects in a pkl file > > > > i.e cPickle.dump(object1, fileobject, -1) >

Re: cPickle

2008-09-04 Thread Gerhard Häring
gopal mishra wrote: I have 3 objects and want to save in one pickle file. I used cPickle to dump 3 objects in a pkl file i.e cPickle.dump(object1, fileobject, -1) cPickle.dump(object2, fileobject, -1) cPickle.dump(object3, fileobject, -1) I have

cPickle

2008-09-04 Thread gopal mishra
I have 3 objects and want to save in one pickle file. I used cPickle to dump 3 objects in a pkl file i.e cPickle.dump(object1, fileobject, -1) cPickle.dump(object2, fileobject, -1) cPickle.dump(object3, fileobject, -1) I have changed the 3rd object

Re: cPickle asymptotic performance?

2008-06-12 Thread Hrvoje Niksic
Eric Jonas <[EMAIL PROTECTED]> writes: >> Try gc.disable() before loading the pickle, and gc.enable() after. >> >> > Is cPickle's behavior known to be O(n^2)? >> >> No, but the garbage collector's sometimes is. > > Wow, that totally fixed it -- we went from 1200 seconds to 60 > seconds. 60 seco

Re: cPickle asymptotic performance?

2008-06-12 Thread Eric Jonas
On Thu, 2008-06-12 at 20:57 +0200, Hrvoje Niksic wrote: > Eric Jonas <[EMAIL PROTECTED]> writes: > > > I've done some benchmarking while attempting to serialize my (large) > > graph data structure with cPickle; I'm seeing superlinear performance > > (plo

Re: cPickle asymptotic performance?

2008-06-12 Thread Calvin Spealman
If you are getting to the point where your data is large enough to really care about the speed of cPickle, then maybe its time you moved past pickles for your storage format? 2.5 includes sqlite, so you could persist them in a nice, indexed table or something. Just a suggestion. On Jun

Re: cPickle asymptotic performance?

2008-06-12 Thread Hrvoje Niksic
Eric Jonas <[EMAIL PROTECTED]> writes: > I've done some benchmarking while attempting to serialize my (large) > graph data structure with cPickle; I'm seeing superlinear performance > (plotting it seems to suggest n^2 where n is the number of nodes of my > gr

cPickle asymptotic performance?

2008-06-12 Thread Eric Jonas
Hello, I've done some benchmarking while attempting to serialize my (large) graph data structure with cPickle; I'm seeing superlinear performance (plotting it seems to suggest n^2 where n is the number of nodes of my graph), in the duration of the pickle.dump calls and I can't q

error during call to cPickle

2007-12-17 Thread Chris Diehl
hello, when pickling a very large object (~200 MB) in python 2.4.4 with cPickle to a file, I get the following errors: python(14896) malloc: *** vm_allocate(size=8421376) failed (error code=3) python(14896) malloc: *** error: can't allocate region python(14896) malloc: *** set a breakpoi

Re: Bug in cPickle with packages and 'object' inherited class

2007-07-29 Thread Gabriel Genellina
En Wed, 25 Jul 2007 17:32:46 -0300, Conrado PLG <[EMAIL PROTECTED]> escribió: > Say you have this structure: > > pna/ > __init__.py > model.py > > > __init__.py is empty. > > model.py is: > > > import cPickle as pickle >

Bug in cPickle with packages and 'object' inherited class

2007-07-25 Thread Conrado PLG
Say you have this structure: pna/ __init__.py model.py __init__.py is empty. model.py is: import cPickle as pickle class A(object): pass def serialize(): pickle.dump(A(), open('temp.dat', 'wb')) Now open a python interpreter on the root directory o

Re: A bug in cPickle?

2007-05-17 Thread Martin v. Löwis
> This does seem odd, at the very least. The differences between the pn codes comes from this comment in cPickle.c: /* Make sure memo keys are positive! */ /* XXX Why? * XXX And does "positive" really mean non-negative? * XXX pickle.py starts with PUT index 0, no

Re: A bug in cPickle?

2007-05-17 Thread Facundo Batista
Victor Kryukov wrote: > The following behavior is completely unexpected. Is it a bug or a by- > design feature? > > ... > > from pickle import dumps > from cPickle import dumps as cdumps > > print dumps('1001799')==dumps(str(1001799)) > print cdumps(

Re: A bug in cPickle?

2007-05-17 Thread Nick Craig-Wood
Victor Kryukov <[EMAIL PROTECTED]> wrote: > The following behavior is completely unexpected. Is it a bug or a by- > design feature? > > from pickle import dumps > from cPickle import dumps as cdumps > > print dumps('1001799')==dumps(str(1001799)) &

Re: A bug in cPickle?

2007-05-16 Thread infidel
ActivePython 2.5.1.1 as well: PythonWin 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> from pickle import dumps >>> from cP

Re: A bug in cPickle?

2007-05-16 Thread Chris Cioffi
On 16 May 2007 10:06:20 -0700, Victor Kryukov <[EMAIL PROTECTED]> wrote: > Hello list, > > The following behavior is completely unexpected. Is it a bug or a by- > design feature? > > Regards, > Victor. > > - > > from pickle import dump

A bug in cPickle?

2007-05-16 Thread Victor Kryukov
Hello list, The following behavior is completely unexpected. Is it a bug or a by- design feature? Regards, Victor. - from pickle import dumps from cPickle import dumps as cdumps print dumps('1001799')==dumps(str(1001799)) print cdumps('1001799')

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Bruno Desthuilliers
Dag a écrit : > I have an application which works with lists of tuples of the form > (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these > lists containing anywhere from 3 to over 3 tuples. The actions I > need to do is either append a new tuple to the end of the list, di

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Paddy
On Apr 11, 5:40 pm, Dag <[EMAIL PROTECTED]> wrote: > I have an application which works with lists of tuples of the form > (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these > lists containing anywhere from 3 to over 3 tuples. The actions I > need to do is either append a

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Bruno Desthuilliers
John Machin a écrit : (snip) > ... and a few more cents: > > There are *two* relations/tables involved (at least): a "tuple" table > and a "list" table. Mmm... From a purely technical POV, not necessarily. If there's no need for anything else than distinguishing between different lists, a singl

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread John Machin
On Apr 12, 7:09 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Dag a écrit : > > > > > I have an application which works with lists of tuples of the form > > (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these > > lists containing anywhere from 3 to over 3 tuples. Th

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Bruno Desthuilliers
Dag a écrit : > I have an application which works with lists of tuples of the form > (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these > lists containing anywhere from 3 to over 3 tuples. The actions I > need to do is either append a new tuple to the end of the list, di

Re: text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 13:40:02 -0300, Dag <[EMAIL PROTECTED]> escribió: > I have an application which works with lists of tuples of the form > (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these > lists containing anywhere from 3 to over 3 tuples. The actions I > need to do

text file vs. cPickle vs sqlite a design question

2007-04-11 Thread Dag
I have an application which works with lists of tuples of the form (id_nr,'text','more text',1 or 0). I'll have maybe 20-50 or so of these lists containing anywhere from 3 to over 3 tuples. The actions I need to do is either append a new tuple to the end of the list, display all the tuples

cPickle FU on Solaris

2007-02-28 Thread Bart Ogryczak
It seems, that on Solaris cPickle is unable to unpickle some values, which it is able to pickle. >>> import cPickle >>> cPickle.dumps(1e-310) 'F9.9694e-311\n.' >>> cPickle.loads(_) Traceback (most recent call last): File "", line 1, in

cPickle EOF Error

2007-02-28 Thread Roopesh
I am trying to write xml files which are inside a zip file into the database. In the zipfile module the function read returns bytes. What I did was to make a blob out of the returned bytes and write it to the database(for this I used cPickle). I also used _mysql's escape_string which escapes

Re: cPickle problems

2006-11-18 Thread Paul McGuire
that defines __slots__ without defining __getstate__ > cannot be pickled > > I think I need to talk to the author of PyParsing about this one... > Thanks for your help! > > > Jeff Jeff - Sorry not to reply sooner, I have been out of town with limited access to c.l.py. Also

Re: cPickle problems

2006-11-16 Thread Klaas
Jeff Poole wrote: > Good idea. Well, I did that, and I found out that the object causing > problems is a ParseResults object (a class from PyParsing) and that the > __getstate__ member is in fact an empty string (''). I'm not sure > where this leaves me... The PyParsing code clearly never crea

Re: cPickle problems

2006-11-16 Thread Jeff Poole
Good idea. Well, I did that, and I found out that the object causing problems is a ParseResults object (a class from PyParsing) and that the __getstate__ member is in fact an empty string (''). I'm not sure where this leaves me... The PyParsing code clearly never creates such a member and my cod

Re: cPickle problems

2006-11-16 Thread Gabriel Genellina
At Thursday 16/11/2006 21:48, Jeff Poole wrote: File "/usr/lib/python2.4/pickle.py", line 313, in save rv = reduce(self.proto) File "/usr/lib/python2.4/copy_reg.py", line 83, in _reduce_ex dict = getstate() TypeError: 'str' object is not callable Someway, self.__getstate__ is a st

Re: cPickle problems

2006-11-16 Thread Jeff Poole
To clutter this up with yet another message, this is what happens if I use pickle instead of cPickle. Same error, but it has more of a stack trace so someone more advanced than myself might be able to pick out what is going amiss. Traceback (most recent call last): File "./generateToo

Re: cPickle problems

2006-11-16 Thread Jeff Poole
Oh, and I suppose I should provide some version information: $ python Python 2.4.3 (#1, May 18 2006, 07:40:45) [GCC 3.3.3 (cygwin special)] on cygwin Jeff Poole wrote: > This is going to be a pretty vague message because it involves a large > block of code I'd rather avoid posting. Basically,

cPickle problems

2006-11-16 Thread Jeff Poole
This is going to be a pretty vague message because it involves a large block of code I'd rather avoid posting. Basically, I've been pickling a dictionary of instances of a class I've created (which contains references to other instances of other classes). At some point in the last few weeks, pick

Re: need helping tracking down weird bug in cPickle

2006-06-23 Thread Dieter Maurer
[Carl J. Van Arsdall] > Hey everyone, cPickle is raising an ImportError that I just don't quite > understand. When I get in such a situation, I replace "cPickle" with Python's "pickle". Usually, I get the same exception -- but this time with a traceba

Re: need helping tracking down weird bug in cPickle

2006-06-20 Thread Tim Peters
[Carl J. Van Arsdall] > Hey everyone, cPickle is raising an ImportError that I just don't quite > understand. When that happens, the overwhelmingly most likely cause is that the set of modules on your PYTHONPATH has changed since the pickle was first created, in ways such th

Re: need helping tracking down weird bug in cPickle

2006-06-20 Thread Scott David Daniels
Carl J. Van Arsdall wrote: > Hey everyone, cPickle is raising an ImportError that I just don't quite > understand. Before I paste the code, let me explain the application. > Basically the part of the application that failed is a function that > loads a list of objects

need helping tracking down weird bug in cPickle

2006-06-20 Thread Carl J. Van Arsdall
Hey everyone, cPickle is raising an ImportError that I just don't quite understand. Before I paste the code, let me explain the application. Basically the part of the application that failed is a function that loads a list of objects from a file using cPickle. This list is a queu

  1   2   >