-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
- Using instructions from the in-class lecture, create a module to test some of the basic functionality of Python's sys module.
Review the README
- Please see README.md for further information on, and use of, this content.
- License for embedded documentation and source codes: IPP-DOC-LIC
Estimated effort may vary greatly
- The estimated level of effort for this exercise shown in the 'Estimate' section below is a very rough approximation. The actual level of effort may vary greatly depending on your development and test environment, experience with the requisite technologies, and many other factors.
Actions
Step 1: Make Sure Your System is Setup for Python and This Course
- See IPP-CFG-01-001
Step 2: REMINDER: Make Sure PYTHONPATH is Set Correctly
Whether running Python tests within your IDE or from the command line, you must set the PYTHONPATH environment variable in every execution environment (e.g., every terminal you launch) when attempting to run any of your scripts and their tests or the IPP test app from the command line. The IPP source and test paths will be as follows:
- {your IPP source code path}
- {your IPP source code path}/tests
See IPP-DEV-01-001 for details.
Step 3: Create your own module to test the sys
module
- Using your IDE, or from within a terminal, create a new Python file - a module - named
SimpleSystemInfo.py
within thelabmodule01
path (or package) - Open the module, and do the following:
- Import the
sys
module - Retrieve the data from
version
and store it inpython_version
- Retrieve the data from
version_info
and store it inversion_data
- Use the
print()
function to display thepython_version
andversion_data
information
- Import the
Estimate
- Small
Tests
-
From within your IDE
- Right click on your newly created module
SimpleSystemInfo.py
and click your IDE'srun
icon - You should see output similar to that discussed in class
- Right click on your newly created module
-
From the command line
- Open a terminal and cd to your
IPP_HOME
path - Start your virtual environment (if not already running)
- Be sure your PYTHONPATH is set correctly
- Run the module
python ./labmodule01/SimpleSystemInfo.py
- You should see output similar to that discussed in class
- Open a terminal and cd to your
Sample output (yours may differ slightly)
Python Version: 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0]
Version Info: sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Lab Module 01 - Setup