Re: [edk2-platforms: PATCH v2] Python run fail if env variable PYTHON_HOME is not set

Chiu, Chasel

-----Original Message-----
From: Cheng, Ching JenX
Sent: Monday, August 19, 2019 5:24 PM
Cc: Chan, Amy <amy.chan@...>; Kubacki, Michael A
<michael.a.kubacki@...>; Chiu, Chasel <chasel.chiu@...>;
Desimone, Nathaniel L <@natedesimone>; Gao, Liming
Subject: [edk2-platforms: PATCH v2] Python run fail if env variable
PYTHON_HOME is not set


[PATCH v2] Update related files

In Platform\Intel\MinPlatformPkg\Tools\Fsp\
It will run another python code.
But if the environment variable "PYTHON_HOME" is not exist and we didn't
add any python's path to "PATH".
It will cause error because python command not found.

the error message as below:
'python' is not recognized as an internal or external command, operable
program or batch file.

So we set the python's path from which execute the python code if
PYTHON_HOME was not exist.

Cc: Amy Chan <amy.chan@...>
Cc: Michael Kubacki <michael.a.kubacki@...>
Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <@natedesimone>
Cc: Liming Gao <liming.gao@...>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng@...>
Platform/Intel/MinPlatformPkg/Tools/Fsp/ | 2
1 file changed, 2 insertions(+)

diff --git
index a8165b08e6..fb4cf4f9b7 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/
@@ -68,6 +68,8 @@ file.close()
pythontool = 'python'
if 'PYTHON_HOME' in os.environ:
pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
+ pythontool = sys.executable
Process = subprocess.Popen([pythontool, splitFspBinPath,
"info","-f",fspBinFilePath], stdout=subprocess.PIPE) Output =
Process.communicate()[0] FsptInfo = Output.rsplit(b"FSP_M", 1);

Join to automatically receive all group messages.