Getting started with IBM Open Enterprise SDK for Python
Ensure the required environment variables are set before getting started with IBM® Open Enterprise SDK for Python. See Environment variables for SMP/E installation or Environment variables for pax archive installation.
Verify your Python version
Check your Python version with the following line:
$ python3 --version
Check
your Python installation location with the following
line:$ python3 -c "import sys; print(sys.executable)"
"Hello world!" script
If the version number and executable path are correct, you are now ready to write your Python script.
For an
EBCDIC
(code page 1047) encoded file, perform the following
steps:$ vi test_script_ebcdic_enc.py
def main():
print("hello world!")
if __name__ == "__main__":
main()
$ chtag -tc IBM-1047 test_script_ebcdic_enc.py
$ python3 test_script_ebcdic_enc.py
For a
UTF-8
encoded file, perform the following
steps:$ vi test_script_utf8_enc.py
def main():
print("hello world!")
if __name__ == "__main__":
main()
$ chtag -tc ISO8859-1 test_script_utf8_enc.py
$ python3 test_script_utf8_enc.py
The message is printed as follows:
hello world!
Note: Ensure that your scripts are tagged correctly to avoid syntax and encoding errors. For more
information, see Codesets and translation.