summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Trim
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-07-27 16:02:05 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-13 09:50:45 +0800
commita09f4c91f785e36f0987aa3a6d7656ba51e6aeda (patch)
tree0a644e4b34f4fceb65d10465dbb6688fcddddfa5 /BaseTools/Source/Python/Trim
parentfe3991d63552f2eb25ff728a81a6976a3b1f652b (diff)
downloadedk2-a09f4c91f785e36f0987aa3a6d7656ba51e6aeda.tar.gz
edk2-a09f4c91f785e36f0987aa3a6d7656ba51e6aeda.tar.bz2
edk2-a09f4c91f785e36f0987aa3a6d7656ba51e6aeda.zip
BaseTools: fix the open file's read and write bugs
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Trim')
-rw-r--r--BaseTools/Source/Python/Trim/Trim.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py
index 4b3091bec3..b9ca83d6d8 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -245,7 +245,7 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
# save to file
try:
- f = open (Target, 'wb')
+ f = open (Target, 'w')
except:
EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
f.writelines(NewLines)
@@ -562,7 +562,7 @@ def TrimEdkSourceCode(Source, Target):
CreateDirectory(os.path.dirname(Target))
try:
- f = open (Source, 'rb')
+ f = open (Source, 'r')
except:
EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
# read whole file
@@ -581,7 +581,7 @@ def TrimEdkSourceCode(Source, Target):
return
try:
- f = open (Target, 'wb')
+ f = open (Target, 'w')
except:
EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
f.write(NewLines)