I have been unable to find a way to write pickled data to text file.
My last attempt was to add the last two lines:

 # the dataevent class -- stores the data that gets transmitted when the
event occurs.
#it is the data in text fields, stored in self.data as a dictionary,
which is basically a c++ map
#One of these classes gets created whenever an event occurs.
class DataEvent(wx.PyEvent):
    # the values of the text fields get passed into the constructor
inside of data
    def __init__(self, data):
        wx.PyEvent.__init__(self)
        # this line *binds* this class to a certain type of event,
wxDATA_EVENT
        self.SetEventType (wxDATA_EVENT)
        # and this is the actual data
        self.data = data
        with open('mypicklelog.txt','a') as log:
            log.write(self.data)

I cant figure out why these last two line dont write to the .txt file
after the program has received the pickled Python dictionary?  Very
stumped.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to