Journal integration doubt

Arjun Sarwal arjun at laptop.org
Sun Oct 21 07:10:57 EDT 2007


I am trying to associate a simple text file with the journal object. Within
a logging session of Measure activity, many logs are created and the file
that I am trying to associate with the journal object would basically
contain the file paths of the logs made in that session so that when the
session is resumed from the journal those log files can be opened and
displayed on the oscilloscope like interface.

The seperate log files get created and written properly. However, I am
facing problems regarding the main file that I try and associate with the
Journal object. This file does get created but disappears when I quit the
activity. I have attached relevant code portions below.

Please point me to some code that might be doing something similar to what I
am trying to do or let me know where I am going wrong.

many thanks,
Arjun


#Create a unique file name using the current time
self._jobject.file_path = os.path.join("/tmp/myLogs" + str(time.time()))

#Create the metadata file to be associated with the journal object
#and write a first line to it
self.f = open(self._jobject.file_path, 'w')
self.f.write("Measure Activity logs metadata file\n")


#Now generate a unique name for the log file and write the name of the log
file #created into the metadata file
self.file_name = ("/tmp/myLogs" + str( time.time()))
self.log_file = open(self.file_name, 'w')
self.f.write(self.file_name + "\n")


#Close metadata file
self.f.close()
self.datastore.write(self._jobject)


#Write the required values onto the log file(s) and then close it(them)
self.log_file.write(str(value1))
self.log_file.write(str(value2))
self.log_file.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20071021/1df59198/attachment.html>


More information about the Devel mailing list