Python Scope is not Working

I’m trying to execute a Python script using the UiPath Python Activities package (v1.6.0)with Python 3.8 (64-bit). The process runs, but it does not produce any output or error — it either hangs or completes silently without any result. if i try some thing like chnaging version it throws the error like "ERROR INITIALIZING the Python eNGINE "

this is my script :

import pandas as pd
import os
#Final Script

File paths

def AddColumn():

    report1_path = r"C:\Users\SHASHANK H M\Downloads\SalesReport1 1.csv"
    iccid1_path = r"C:\Users\SHASHANK H M\Downloads\ICCIDreport1.xlsx"
    
    # Output path (Excel)
    report1_updated_path = os.path.splitext(report1_path)[0] + "_Updated.xlsx"
    
    # Load CSV and Excel with all data as string to preserve formatting
    report1 = pd.read_csv(report1_path, dtype=str)
    iccid1 = pd.read_excel(iccid1_path, dtype=str, engine="openpyxl")
    
    # Clean key columns
    report1['SERVICENUMBER_P'] = report1['SERVICENUMBER_P'].str.strip()
    iccid1['SERV_NO'] = iccid1['SERV_NO'].str.strip()
    iccid1['SIM_NO'] = iccid1['SIM_NO'].str.strip()
    
    # Ensure SIM_NO column exists in report1
    if 'SIM_NO' not in report1.columns:
        report1['SIM_NO'] = ''
    
    # Create mapping: service number → SIM number
    service_to_sim = dict(zip(iccid1['SERV_NO'], iccid1['SIM_NO']))
    
    # Update SIM_NO in report1 only where match found
    #report1['SIM_NO'] = report1['SERVICENUMBER_P'].map(service_to_sim).fillna(report1['SIM_NO'])
    report1['SIM_NO'] = report1['SERVICENUMBER_P'].map(service_to_sim).fillna("Not Found")
    
    
    # Save as Excel (preserving long numbers)
    report1.to_excel(report1_updated_path, index=False, engine='openpyxl')
    
    print("✅ Updated Excel file saved as:")
    print(report1_updated_path)

my python exe location is : C:\Python38

@Shashank_H_M,

follow this how to guide and build your workflow accordingly.

You can also refer this sample code.

https://docexamples.uipath.com/examples/Activities/Python%20v3.12%20-%20Invoking%20a%20script.zip

@Shashank_H_M ,

I hope below thread will help you to solve python scope error.

Thanks & Regards,
Ronak Patel

Could you please try with

  • Python 3.6 or 3.7 (64-bit)

Python 3.8 is not officially supported in some older versions of the Python Activities package.

Check the below release notes to identify the versions supported by each of the python package versions

Activities - Release notes

Also I would suggest to try with a smaller code to make sure that it is not compatibility issue

@Shashank_H_M

Welcome to the community

  1. First check if .net runtime is installed and version is 6+
  2. generally if .net is not installed when you run and open event viewer logs you would see error there

cheers

cheers