mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 19:34:18 -04:00
fix exception handling in Python 2
This commit is contained in:
parent
53b472756b
commit
151b22ddf0
@ -903,7 +903,8 @@ def ReadFile(wfile):
|
|||||||
data = srchandle.read()
|
data = srchandle.read()
|
||||||
srchandle.close()
|
srchandle.close()
|
||||||
return data
|
return data
|
||||||
except ex:
|
except:
|
||||||
|
ex = sys.exc_info()[1]
|
||||||
exit("Cannot read %s: %s" % (wfile, ex))
|
exit("Cannot read %s: %s" % (wfile, ex))
|
||||||
|
|
||||||
def ReadBinaryFile(wfile):
|
def ReadBinaryFile(wfile):
|
||||||
@ -912,7 +913,8 @@ def ReadBinaryFile(wfile):
|
|||||||
data = srchandle.read()
|
data = srchandle.read()
|
||||||
srchandle.close()
|
srchandle.close()
|
||||||
return data
|
return data
|
||||||
except ex:
|
except:
|
||||||
|
ex = sys.exc_info()[1]
|
||||||
exit("Cannot read %s: %s" % (wfile, ex))
|
exit("Cannot read %s: %s" % (wfile, ex))
|
||||||
|
|
||||||
def WriteFile(wfile, data):
|
def WriteFile(wfile, data):
|
||||||
@ -920,7 +922,8 @@ def WriteFile(wfile, data):
|
|||||||
dsthandle = open(wfile, "w")
|
dsthandle = open(wfile, "w")
|
||||||
dsthandle.write(data)
|
dsthandle.write(data)
|
||||||
dsthandle.close()
|
dsthandle.close()
|
||||||
except ex:
|
except:
|
||||||
|
ex = sys.exc_info()[1]
|
||||||
exit("Cannot write to %s: %s" % (wfile, ex))
|
exit("Cannot write to %s: %s" % (wfile, ex))
|
||||||
|
|
||||||
def WriteBinaryFile(wfile, data):
|
def WriteBinaryFile(wfile, data):
|
||||||
@ -928,7 +931,8 @@ def WriteBinaryFile(wfile, data):
|
|||||||
dsthandle = open(wfile, "wb")
|
dsthandle = open(wfile, "wb")
|
||||||
dsthandle.write(data)
|
dsthandle.write(data)
|
||||||
dsthandle.close()
|
dsthandle.close()
|
||||||
except ex:
|
except:
|
||||||
|
ex = sys.exc_info()[1]
|
||||||
exit("Cannot write to %s: %s" % (wfile, ex))
|
exit("Cannot write to %s: %s" % (wfile, ex))
|
||||||
|
|
||||||
def ConditionalWriteFile(dest, desiredcontents):
|
def ConditionalWriteFile(dest, desiredcontents):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user