Let’s create a simple “Hello, World!” Python application on IBM i.
Setting Up Your Environment
Ensure you have Python installed on your IBM i system. If not, you can install it easily using the IBM i ACS Opensource installer
Open a terminal or SSH session to your IBM i system
Create a Directory in the IFS
Navigate to a suitable location and create a new directory for your project. For example:
mkdir /home/HelloWorldApp
cd /home/HelloWorldApp
Create a Python File
Inside the HelloWorldApp
directory, create a new Python file (e.g., yourAppName.py
):
touch hello_world_app.py
Edit the Python File
Open hello_world_app.py
in a text editor. You can use EDTF in IBM i command line, or any IFS File code editor — my recommendation is to use Visual Studio Code
Add the following simple line of code to your app.py
file:
print('Hello World')
Run Your Application from PASE
Execute your Python script to set your environment and call your new python script:
PATH=/QOpenSys/pkgs/bin:$PATH
export PATH
python3 hello_world_app.py
Congratulations! You’ve created a basic “Hello World” Python application on IBM i.
You should see the output: “Hello World”
The next adventure is to build upon this foundation for more complex projects! Happy coding!