BaseTools:Run packagedoc_cli.py to generate doc failed

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>
This commit is contained in:
Fan, ZhijuX 2019-03-01 10:52:24 +08:00 committed by Feng, Bob C
parent c3947b5423
commit 8ef3a6ec1f
1 changed files with 4 additions and 3 deletions

View File

@ -376,9 +376,10 @@ class PackageDocumentAction(DoxygenAction):
return
try:
f = open(path, 'r')
lines = f.readlines()
f.close()
with open(path, 'r') as f:
lines = f.readlines()
except UnicodeDecodeError:
return
except IOError:
ErrorMsg('Fail to open file %s' % path)
return