March 22

0 comments

Create a “Hello World” Python Application on IBM i

By NickLitten

March 22, 2024

Python

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')
Create a “hello world” python application on ibm i 1

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”

Create a “hello world” python application on ibm i 2

The next adventure is to build upon this foundation for more complex projects! Happy coding!

For more details, refer to the official IBM documentation.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>