Re: [edk2] help with python in uefi shell

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

From: Wissam Shoukair <wissams@mellanox.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

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...)

Thanks 
________________________________
Date: Tue, 4 Dec 2012 02:20:03 +0000
From: "Mcdaniel, Daryl" 
Subject: Re: [edk2] help with python in uefi shell
To: "edk2-devel@lists.sourceforge.net"
	
Message-ID:
	<66BD57653246D24E9698B0A6509545A83FBA85A4@ORSMSX101.amr.corp.intel.com>
	
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 os.py, ntpath.py, pydoc.py, and site.py 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 os.py.  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 [mailto:wissams@mellanox.com]
Sent: Sunday, December 02, 2012 2:58 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] help with python in uefi shell

Hi,
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 ??

Thanks

Regards,
Wissam

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
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel