03 - Open Source (EN)03d - Phython (EN)

Python and IBM i – FAQ, tips and howto (EN)

Last Updated on 5 September 2019 by Roberto De Pedrini

Python applications on IBM i? Let’s start with the python installation and then take the first steps in this fascinating world of Open Source and everything that opens up to the IBM i world.

A collection of questions/answers, tips and howto taken from forums and other IBM i and Python websites. If you want to contribute to this collection also use the comment area at the bottom of the page!

iPY001 – First Steps with Python on IBM i (step-by-step guide)

Following an IT-Jungle guide by Stephanie Rabbani (“Guru: Getting Started With Python On IBM i”) and a few more posts around the web (“Introduction to Python for IBM i” by Mike Pavlak and “Pratical guide to Python” by Kevin Adler) I installed Python3 on my IB machine M i 7.2.

In less than 20 minutes I tested the classic Hello World and downloaded from Github a project by Alan Seiden Group with some nice examples of Python and IBM i… isn’t that great? This is where the beauty … compared to classic RPG development with Python (and other languages available on IBM i) we can find around thousands of Open Source applications to assemble together in our projects.

Here are the few steps taken, with some commentary, and, to follow, the references of the material:

  • From IBM ACS Access Client Solution I choose “Tools – Open Source Package Management”
  • Install or update if the “yum” and “python3” and “git” packages are out of date
  • I open a session with Putty in SSH on my IBM i (absolutely better than QP2TERM!)
  • I update the PATH as indicated in Stephanie Rabbani’s guide ( PATH/QOpenSys/pkgs/bin:$PATH export PATH )
  • I create in my home IFS a small program with only the statement ” print(“hello world”) ” (beware of print in lowercase and not in uppercase as in the guide!)
  • I run my first Hello Word program : “python3 /home/faq400/hello.py” (also here be careful to write python3 in lowercase!
  • First step taken … let’s see if I find something ready to test …
  • I go to Github and find “Pyhon for IBM i example” of Club Seiden
  • I try to download the project with git “git clone https://github.com/Club-Seiden/python-for-IBM-i-examples.git” … but I have a problem with HTTPS (“fatal: Unable to find remote helper for ‘https'”)
  • I argue a little trying to disable the signature check but nothing to do …
  • They then clone the repository with this command, which works excellently “git clone git://github.com/Club-Seiden/python-for-IBM-i-examples.git
  • I put myself in the service directory “active job dashboard” ( cd /home/faq400/python-for-IBM-i-examples/non-wheel/active-jobs-dashboard/ )
  • I run the Python application that generates me a waiting http server: ” python3 ./server.py “
  • I try the application on port 3333 at the ip address of my IBM i (http://192.168.xxx.xxx:3333/)
  • It can be done!

In this great post on IT-Jungle we see how to install Python3 on our IBM i using the appropriate Open Source product management feature of ACS … The thing is simple … it takes you less than 20 minutes to make a small Hello Word or download a ready-made project from Github:

iPY002 – First Steps with Python on IBM i (video)

Thanks to this video by Moammed Yusuf each of us can try to do small things with Python3 on IBM i with access to DB2 … without even installing anything on your system but using the excellent PUB400.COM service

How to connect IBM i db2 using Python yusy4code property

Related Posts
DB2 for i SQL – String Manipulation – POSSTR-LOCATE-LOCATE_IN_STRING (EN)

Introduction Often, in our applications, we need to work with text strings, and DB2 SQL can come in very useful Read more

DB2 for i – FAQ & Howtos (EN)

DB2 Database and SQL ... maybe the most important things on IBM i platform: here's a collection of FAQs, tips Read more

IBM i 7.4 Announcement (En)

Comes directly with the Easter egg this IBM announcement for the news of the IBM i 7.4 version, iNext version Read more

Generated Always Columns (EN)

Introduction "Generated Always Column": are columns, table fields, filled by DB2 engine: something like columns with a default value but Read more

--- Roberto De Pedrini Faq400.com
About author

Founder of Faq400 Srl, IBM Champion, creator of Faq400.com and blog.faq400.com web sites. RPG developer since I was wearing shorts, strong IBM i supporter, I have always tried to share my knowledge with others through forums, events and courses. Now, with my company Faq400 Srl, I help companies to make the most of this great platform IBM i.

Leave a Reply

Your email address will not be published. Required fields are marked *