Are there any stipulations on the use of file streams and/or other variables in Python between concurrent threads?
For example, if I open a file stream in a main thread to a log file:
Code:
Can I call Server.log or Server.elog within another thread? I am having issues in the TI-Trek server, where log files aren't being written to and I'm wondering if this is the culprit.
For example, if I open a file stream in a main thread to a log file:
Code:
# These are methods of Class "Server".
def __init__ (self):
....
self.mlogf = open("logs/messages.txt","a+")
self.elogf = open("logs/errors.txt","a+")
self.ilogf = open("logs/log.txt","a+")
def log(self,*args,**kwargs):
print(*args,**kwargs)
for arg in args:
self.ilogf.write(str(arg)+" ")
self.ilogf.write("\n")
def elog(self,*args,**kwargs):
self.log(*args,**kwargs)
for arg in args:
self.elogf.write(str(arg)+" ")
self.elogf.write("\n")
Can I call Server.log or Server.elog within another thread? I am having issues in the TI-Trek server, where log files aren't being written to and I'm wondering if this is the culprit.