<span style="color: rgb(0, 0, 0);">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.<br><br>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.
<br><br>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.<br><br>many thanks,<br>Arjun<br><br><br>#Create a unique file name using the current time
</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">
self._jobject.file_path = os.path.join("/tmp/myLogs" + str(time.time()))</span><br style="color: rgb(0, 0, 0);"><br>#Create the metadata file to be associated with the journal object<br>#and write a first line to it
<br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">self.f = open(self._jobject.file_path, 'w')
</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">self.f.write("Measure Activity logs metadata file\n")</span><br style="color: rgb(0, 0, 0);"><br><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);">#Now generate a unique name for the log file and write the name of the log file #created into the metadata file</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">
self.file_name = ("/tmp/myLogs" + str(
time.time())) </span><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);">self.log_file = open(self.file_name, 'w')<br>self.f.write(self.file_name + "\n")
</span><br style="color: rgb(0, 0, 0);"><br><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">#Close metadata file<br>self.f.close()<br>self.datastore.write(self._jobject)<br><br><br>#Write the required values onto the log file(s) and then close it(them)
<br>self.log_file.write(str(value1))<br></span><span style="color: rgb(0, 0, 0);">self.log_file.write(str(value2))</span><br><span style="color: rgb(0, 0, 0);">self.log_file.close()<br></span><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);"></span><br style="color: rgb(0, 0, 0);" clear="all">
<br>