Skip to main content

Hello,

 

I’ve built a Python Test bot to ensure python is running correctly in all environments. This works great on my local, but not when the runner bot tries to run it in Prod. 

The Entire Bot Process
import pandas as pd
import numpy as np
import os

def add_success_message(input_string):
"""
Takes a string input, creates a 1x2 DataFrame, and combines the values.

Args:
input_string (str): The input string to modify

Returns:
str: Combined string from DataFrame values
"""
try:
# Create a 1x2 DataFrame
df = pd.DataFrame({
'input': tinput_string],
'message': e'and it ran great']
})

# Get random number (for demonstration)
random_num = np.random.rand()

# Get current working directory (for demonstration)
current_dir = os.getcwd()

# Combine values from the DataFrame
result = f"{df"'input'].iloci0]} {df 'message'].iloci0]} got random number {random_num:.2f} in directory {current_dir}"

# Optional: Display the DataFrame
print("\nDataFrame contents:")
print(df)

return result

except Exception as e:
return f"Error processing string: {str(e)}"

Above is the bot and the code manually entered into the bot. This is the error message it emails me: 

ERROR message: There was an error while opening the manually input Python Script at line: 7

The error appears to happen before it even tries to execute the script. I have python 3.7.9 installed on the virtual machine running this bot, as it appeared that was the best version to work with Automation Anywhere.

Make sure you have Python installed on your bot runner machine. For more information, check your bot runner logs. 


@Jenna4321 - Hi ,

Since there is already python 3.7.9 is installed, could you please check below library also installed in your runner machines? 
pandas , numpy and  os


I installed pandas and numpy for sure. I’m not 100% if os got all of the way installed, but it won’t even open python. When I tested this on my local, it gave me a different error for not having pandas, numpy and os installed, it said it was missing modules. 


UPDATE: I tried separating this out to be a .py file, and simplifying the code. The code is now:
 

def say_hello(input):
return f"Hello World from {input}"

and I get this error: ERROR message: There was an error while opening the Python C:\Users\prod\printhello.py at line: 7

 


Hi ​@Jenna4321 ,

have you done like this?

 

 

Python installed properly?

 

Cheers

Marc


Hi ​@Jenna4321 ,

 

Have you set the Environmental Variable for Python in your runner machine?

 

 


SOLVED: The issue was that the virtual machine had multiple users and not all of the users had python installed. On my local that gave an error about the path, but on the virtual machine it gave an error at the open script step.

 

Thank you!


Reply