ParticlePanel: fixed an issue that prevented saving with Python 3

Since in Python 3 `str == bytes` no longer holds true, I modified
the source to write a text file, which it actually is, instead of a
binary file.

Closes #553
Fixes #543
This commit is contained in:
tc 2019-02-08 13:20:46 +01:00 committed by rdb
parent 3875cc8259
commit 33d11dba27

View File

@ -163,7 +163,7 @@ class ParticleEffect(NodePath):
def saveConfig(self, filename):
filename = Filename(filename)
f = open(filename.toOsSpecific(), 'wb')
with open(filename.toOsSpecific(), 'w') as f:
# Add a blank line
f.write('\n')
@ -199,9 +199,6 @@ class ParticleEffect(NodePath):
fg.printParams(f, target)
f.write('self.addForceGroup(%s)\n' % target)
# Close the file
f.close()
def loadConfig(self, filename):
data = vfs.readFile(filename, 1)
data = data.replace(b'\r', b'')