Importing and Using Python Libraries in Infor OS ION Script

Player24
Player24 Unconfirmed, Member Posts: 2

In Infor OS, ION, Script, what's the simplest way to import a Python library and use it in a script?

Comments

  • Player24
    Player24 Unconfirmed, Member Posts: 2
    edited October 14

    ION Scripting uses Python for custom scripts, and it supports importing external libraries using the Python Wheels format. Here's a basic guide:

    1. Choose a Compatible Library: Ensure the library is available as a Python Wheel file and compatible with the supported Python versions and tags in ION Scripting. You can find details on supported tags in the Infor documentation: Supported libraries - Infor Documentation Central
    2. Upload the Library: Upload the Wheel file to a location accessible by your ION Script. This might involve uploading it to a specific directory within your Infor OS environment or using a repository manager.
    3. Import in Your Script: Once the library is available, you can import it in your script using the standard Python import statement. For example, to import the pandas library:
    import pandas as pd 
    

    4. Use the Library: After importing, you can utilize the library's functions and classes in your script. For instance, you can use pandas to manipulate data:

    import pandas as pd
    
    # Sample data
    data = {'Name': ['Alice', 'Bob', 'Charlie'], 
            'Age': [25, 30, 28]}
    
    # Create a pandas DataFrame
    df = pd.DataFrame(data)
    
    # Print the DataFrame
    print(df)
    

    Code Output

          Name  Age
    0    Alice   25
    1      Bob   30
    2  Charlie   28