Sfoglia il codice sorgente

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

rdb 5 anni fa
parent
commit
20f38cad66

+ 1 - 1
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.
     """
 

+ 1 - 1
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)

+ 2 - 2
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],