Skip to main content
Solved

Python Error Opening Manually Input Python Script

  • May 2, 2025
  • 7 replies
  • 177 views

Jenna4321
Forum|alt.badge.img+2

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': [input_string],
'message': ['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'].iloc[0]} {df['message'].iloc[0]} 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.

Best answer by Jenna4321

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!

7 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • May 3, 2025

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


amore17
Navigator | Tier 3
Forum|alt.badge.img+6
  • Navigator | Tier 3
  • May 3, 2025

@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


Jenna4321
Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • May 5, 2025

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. 


Jenna4321
Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • May 5, 2025

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

 


Marc Mueller
Most Valuable Pathfinder
Forum|alt.badge.img+17
  • Most Valuable Pathfinder
  • May 6, 2025

Hi ​@Jenna4321 ,

have you done like this?

 

 

Python installed properly?

 

Cheers

Marc


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • May 6, 2025

Hi ​@Jenna4321 ,

 

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

 

 


Jenna4321
Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • Answer
  • May 6, 2025

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!