Re: Pickle and wx.TextCtrl

2008-07-17 Thread DWebre


D. J. Webre, Jr. PE  PLS



   
 Gabriel  
 Genellina
 [EMAIL PROTECTED]  To
 com.ar   python-list@python.org  
 Sent by:   cc
 python-list-bounc 
 esSubject
 +djwebre=dotd.la. Re: Pickle and wx.TextCtrl
 [EMAIL PROTECTED]
   
   
 07/11/2008 10:51  
 PM
   


Thanks for the response.

En Fri, 11 Jul 2008 10:15:36 -0300, [EMAIL PROTECTED] escribió:

 Trying to read a pickled file and list contents.

 The attached program works using pprint, but I want to write to my frame.
 WriteText only produces half of the records.
 What is happening?

What do you mean by only produces half of the records?

Write Text list records from Assignment to Report
pprint list records from Assignment to Report and continues to
TaskWeek, about twice as many records

Probably your problem has nothing to do with a TextCtrl - ensure you can
save and load your data with a simple, console-based script, and only then
write the GUI.
The way you read the file is rather strange -mixing calls to readline and
pickle.load- I'd write the data using pickle.dump calls *only* and then
read it using pickle.load calls *only*.

I used 13.1.7 Example of the Python Library Referencebut.  Got an error
message when I did not have the readline() statement.

Additional ideas will be appreciated.
--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list
inline: graycol.gifinline: pic20037.gifinline: ecblank.gif--
http://mail.python.org/mailman/listinfo/python-list

Re: Pickle and wx.TextCtrl

2008-07-17 Thread Gabriel Genellina

En Thu, 17 Jul 2008 09:40:29 -0300, [EMAIL PROTECTED] escribi�:


The way you read the file is rather strange -mixing calls to readline and
pickle.load- I'd write the data using pickle.dump calls *only* and then
read it using pickle.load calls *only*.

I used 13.1.7 Example of the Python Library Referencebut.  Got an error
message when I did not have the readline() statement.


The example doesn't have any readline(). Make sure you open the file in  
binary format ('wb' or 'rb').
If you have a list of objects: just write the list. It takes a single call  
to pickle.dump(), and later, a single call to picle.load()
If you have too many objects and don't want to save/load all of them at  
once, write them one at a time using pickle.dump(element, output_file,  
-1), ending with a sentinel value (e.g. None): pickle.dump(None, ...)

You may read them again using something like this:

pfile = open(..., 'rb')
while True:
  element = pickle.load(pfile)
  if element is None: break
  do_something_with(element)
pfile.close()

Ensure that you can save and load your data using a simple script,  
*before* writing the GUI.


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Re: Pickle and wx.TextCtrl

2008-07-15 Thread DWebre



D. J. Webre, Jr. PE  PLS




   
 Gabriel  
 Genellina
 [EMAIL PROTECTED]  To
 com.ar   python-list@python.org  
 Sent by:   cc
 python-list-bounc 
 esSubject
 +djwebre=dotd.la. Re: Pickle and wx.TextCtrl
 [EMAIL PROTECTED]
   
   
 07/11/2008 10:51  
 PM
   


Thanks for the response.

En Fri, 11 Jul 2008 10:15:36 -0300, [EMAIL PROTECTED] escribió:

 Trying to read a pickled file and list contents.

 The attached program works using pprint, but I want to write to my frame.
 WriteText only produces half of the records.
 What is happening?

What do you mean by only produces half of the records?

Write Text list records from Assignment to Report
pprint list records from Assignment to Report and continues to
TaskWeek, about twice as many records

Probably your problem has nothing to do with a TextCtrl - ensure you can
save and load your data with a simple, console-based script, and only then
write the GUI.
The way you read the file is rather strange -mixing calls to readline and
pickle.load- I'd write the data using pickle.dump calls *only* and then
read it using pickle.load calls *only*.

I used 13.1.7 Example of the Python Library Referencebut.  Got an error
message when I did not have the readline() statement.

Additional ideas will be appreciated.
--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list
inline: graycol.gifinline: pic19718.gifinline: ecblank.gif--
http://mail.python.org/mailman/listinfo/python-list

Re: Pickle and wx.TextCtrl

2008-07-11 Thread Gabriel Genellina

En Fri, 11 Jul 2008 10:15:36 -0300, [EMAIL PROTECTED] escribió:


Trying to read a pickled filed and list contents.

The attached program works using pprint, but I want to write to my frame.
WriteText only produces half of the records.
What is happening?


What do you mean by only produces half of the records?
Probably your problem has nothing to do with a TextCtrl - ensure you can  
save and load your data with a simple, console-based script, and only then  
write the GUI.
The way you read the file is rather strange -mixing calls to readline and  
pickle.load- I'd write the data using pickle.dump calls *only* and then  
read it using pickle.load calls *only*.


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list