From 20f38cad664667c02ac665d2526aefaa8287b836 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 30 Dec 2020 22:35:24 +0100 Subject: [PATCH] direct: Fix a few remaining uses of file() instead of open() --- direct/src/directnotify/RotatingLog.py | 2 +- direct/src/directutil/DistributedLargeBlobSenderAI.py | 2 +- direct/src/distributed/DistributedCameraOV.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/direct/src/directnotify/RotatingLog.py b/direct/src/directnotify/RotatingLog.py index 5eb5706c95..d7b9b06d34 100755 --- a/direct/src/directnotify/RotatingLog.py +++ b/direct/src/directnotify/RotatingLog.py @@ -4,7 +4,7 @@ import time 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. """ diff --git a/direct/src/directutil/DistributedLargeBlobSenderAI.py b/direct/src/directutil/DistributedLargeBlobSenderAI.py index 648599731d..514033face 100755 --- a/direct/src/directutil/DistributedLargeBlobSenderAI.py +++ b/direct/src/directutil/DistributedLargeBlobSenderAI.py @@ -42,7 +42,7 @@ class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI): break # NOTE: there's a small chance of a race condition here, if # the file is created by another AI just after the stat fails - f = file(filename, 'wb') + f = open(filename, 'wb') f.write(s) f.close() os.chdir(origDir) diff --git a/direct/src/distributed/DistributedCameraOV.py b/direct/src/distributed/DistributedCameraOV.py index a539b12794..bdf9369b45 100755 --- a/direct/src/distributed/DistributedCameraOV.py +++ b/direct/src/distributed/DistributedCameraOV.py @@ -24,7 +24,7 @@ class DistributedCameraOV(DistributedObjectOV): self.fixtures = fixtures def storeToFile(self, name): - f = file('cameras-%s.txt' % name, 'w') + f = open('cameras-%s.txt' % name, 'w') f.writelines(self.getObject().pack()) f.close() @@ -35,7 +35,7 @@ class DistributedCameraOV(DistributedObjectOV): def loadFromFile(self, name): self.b_setFixtures([]) - f = file('cameras-%s.txt' % name, 'r'); + f = open('cameras-%s.txt' % name, 'r') for line in f.readlines(): pos,hpr,fov = self.unpackFixture(line) self.addFixture([pos[0],pos[1],pos[2],