The reason for this problem is that the file was opened incorrectly.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
return\r
\r
try:\r
- f = open(path, 'r')\r
- lines = f.readlines()\r
- f.close()\r
+ with open(path, 'r') as f:\r
+ lines = f.readlines()\r
+ except UnicodeDecodeError:\r
+ return\r
except IOError:\r
ErrorMsg('Fail to open file %s' % path)\r
return\r