direct: Fix a few remaining uses of file() instead of open()

This commit is contained in:
rdb 2020-12-30 22:35:24 +01:00
parent b7124da4aa
commit 20f38cad66
3 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import time
class RotatingLog: class RotatingLog:
""" """
A file() (or open()) replacement that will automatically open and write An `open()` replacement that will automatically open and write
to a new file if the prior file is too large or after a time interval. to a new file if the prior file is too large or after a time interval.
""" """

View File

@ -42,7 +42,7 @@ class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI):
break break
# NOTE: there's a small chance of a race condition here, if # NOTE: there's a small chance of a race condition here, if
# the file is created by another AI just after the stat fails # the file is created by another AI just after the stat fails
f = file(filename, 'wb') f = open(filename, 'wb')
f.write(s) f.write(s)
f.close() f.close()
os.chdir(origDir) os.chdir(origDir)

View File

@ -24,7 +24,7 @@ class DistributedCameraOV(DistributedObjectOV):
self.fixtures = fixtures self.fixtures = fixtures
def storeToFile(self, name): def storeToFile(self, name):
f = file('cameras-%s.txt' % name, 'w') f = open('cameras-%s.txt' % name, 'w')
f.writelines(self.getObject().pack()) f.writelines(self.getObject().pack())
f.close() f.close()
@ -35,7 +35,7 @@ class DistributedCameraOV(DistributedObjectOV):
def loadFromFile(self, name): def loadFromFile(self, name):
self.b_setFixtures([]) self.b_setFixtures([])
f = file('cameras-%s.txt' % name, 'r'); f = open('cameras-%s.txt' % name, 'r')
for line in f.readlines(): for line in f.readlines():
pos,hpr,fov = self.unpackFixture(line) pos,hpr,fov = self.unpackFixture(line)
self.addFixture([pos[0],pos[1],pos[2], self.addFixture([pos[0],pos[1],pos[2],