Re: [edk2] help with python in uefi shell

Subject: Re: [edk2] help with python in uefi shell

From: Wissam Shoukair <>

To: "" <>

Date: 2012-12-04 17:58:02

Hi Daryl,
Thanks for the reply.

I already copied the files from PyMod-2.7.2/Lib. I also was able to run the python with or without the -S flag.
Apparently I wasn't running python from the right directory. (Beginners problems...)

Date: Tue, 4 Dec 2012 02:20:03 +0000
From: "Mcdaniel, Daryl" 
Subject: Re: [edk2] help with python in uefi shell
To: ""
Content-Type: text/plain; charset="us-ascii"

Hello Wissam,

There are a few things to check that are not clearly stated in the PythonReadMe.txt file.

Make sure that you are using the,,, and files from PyMod-2.7.2/Lib, instead of the versions from Python-2.7.2/Lib.

If you start Python with the -S option, it will skip the above files and should go directly to the interactive prompt.  If it does, you will be able to exit by typing
>>> import sys
>>> sys.exit
Also, make sure that you start Python from a directory on the same volume that Python.efi and the Python library are on.  If running the Shell on real hardware, this will be something like fs0:.

>From the information you quoted, Python was able to find  I don't know what the ") lost sys.stderr" indicates, other than (hopefully) a cut-and-paste error or something is horribly wrong somewhere.  If you look in the Python library directory, you will see that there are one or more .pyc files now.  Every module that Python was able to successfully import will be indicated by a .pyc file.

Please let me know the outcome of copying the files from PyMod-2.7.2/Lib and also of starting Python with the -S option.  Any diagnostic messages you can provide, especially the debug messages that are sent out of the serial port, would also be useful.

Best of Luck,
Daryl McDaniel

"Software is like entropy.
 It is difficult to grasp, weighs nothing, and obeys the second law of thermodynamics;  i.e. it always increases."
-- Norman R. Augustine

From: Wissam Shoukair []
Sent: Sunday, December 02, 2012 2:58 AM
Subject: [edk2] help with python in uefi shell

I'm new to UEFI, so any help will be great.
I'm trying to run a simple "hello world" python script in the uefi shell.
I followed the instructions in "edk2/AppPkg/Applications/Python/PythonReadMe.txt" to setup python.
When I ran the Python.efi from I got this error:

ImportError: No module named site
   close failed in file object destruction:
     sys.excepthook is missing
) lost sys.stderr
Print_file_and_lineExit status code: Unsupported

Any idea how can I fix this ??



Wissam Shoukair | Software Engineer | Mellanox Technologies Ltd.
Work: +972 74 7236820 | Cell +972 50 783 6933

LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
edk2-devel mailing list