mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
direct: Fix a few remaining uses of file() instead of open()
This commit is contained in:
parent
b7124da4aa
commit
20f38cad66
@ -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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user