[Tutor] Need help printing a pickled data

Prasad, Ramit ramit.prasad at jpmorgan.com
Tue Jun 25 20:02:33 CEST 2013


Again, please leave in attributions.

Matt D wrote:
> [Ramit Prasad wrote]
> >
> > Well I think self.data is some kind of container with a pickled string,
> > given the code to unpickle it is:
> >
> Exactly!  This is what the C++ file 'pickle.h' creates to send to the
> Python GUI:

Not really.

> 
> 
> /**
>  * A pickled Python dictionary. Used to pass stuff to the UI.
>  */
> class pickle
> {
> 
[snip C++ code]
> 
> };

You can call it a pickle, but it is not actually a pickle. It is
a wrapper around pickled data. That is *not* the same thing. 

> 
> #endif /* INCLUDED_PICKLE_H */
> 
> I am pretty sure that it sends a C++ map of strings in a form that
> Python understands as a pickle.  I put the code you gave me into the
> file so ill have to wait and see.
> meanwhile can you please take a look at this update() and tell me if you
> see something wrong because ever sense I tried using the array for
> logging the values from the TextCtrls the program is not updating
> meaning when the program receives the c++ map, or the pickle, I get
> nothing in the UI and I get nothing in the log.  There got to be
> something wrong with the loop that I can not see.  I attached the file
> so its not too much code here.  I am pretty sure the problem is in the
> update(0) starts at line 210.
> 



I have 2 concerns.
1. Based on your results, I doubt if you can call to_string more than once
2. I don't think it's a good idea to log the pickle from the DataEvent.__init__. 
You should do all logging from update or display_data. 

Look at my most recent email it gives better code. If you really want
to store the pickle data then write pickled_dict to file and remove
the logging code from the DataEvent.__init__. I suspect that will give you
the results you want again.


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list