Python Output not showing up

import sys
import pandas as pd

operator = input()

# Read CSV file into a pandas DataFrame
df = pd.read_csv('NameSymbol.csv')

def find_name_by_symbol(operator):
    # Find the row where the 'Symbol' column matches the 'operator' argument
    row = df.loc[df['Symbols'] == operator]

    # If no row was found, return None
    if row.empty:
        return None

    # Return the value in the 'Names' column of the row
    return row['Name'].iloc[0]

# Example usage

name = find_name_by_symbol(operator)

if name:
    sys.exit(name)
else:
    print(f"No name found for {operator}")
​​{
  "Name": "1Sec History",
  "CreationDate": "2023-5-8",
  "Commands": [
    {
      "Command": "prompt",
      "Target": "What coin would you like to record data for?@bitcoin",
      "Value": "operator",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Running name check on ${operator}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XRunAndWait",
      "Target": "/home/user/Desktop/coin_targetcheck/bin/python3",
      "Value": "/coin_targetcheck/targetcheck.py ${name}",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://coinmarketcap.com/currencies/${name}/",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "waitForPageToLoad",
      "Target": "",
      "Value": "",
      "Description": ""
    },

How do I get python output into UI Vision. I saw a post where someone used ${a} as an anwser var but Im not sure if thats really what was going on and everytime I get a code 2 and everytime I test it, it works but will exit

To get data back from a script that you call you have two options:

  • Return it as an exit code (if it is just a number). Then you can access it inside Ui.Vision with the ${!xrun_exitcode} variable

  • Save the data or string as CSV file in your Python script, and read it with csvRead or csvReadArray inside Ui.Vision

I was able to change my input to a csv in the python script then I called it will the RPA. Thank you!

Im back! The read function on the program is now throwing a code 2 again… This time on the fact that the CSV file isnt being created by the script Im running. Nothing changed so Im wondering if this is an issue with the program.

Hi, is this an error in the Python code or inside the RPA macro?

The py code runs in VSCode with the debugger, so I think its a RPA issue, I dont know as Im not a very skilled python developer. I could reupload both codes here if that helps?

{
  "Name": "CMC_ 1Sec History",
  "CreationDate": "2023-5-10",
  "Commands": [
    {
      "Command": "prompt",
      "Target": "What coin would you like to record data for?@bitcoin",
      "Value": "StartString",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${StartString}",
      "Value": "!csvLine",
      "Description": ""
    },
    {
      "Command": "csvSave",
      "Target": "/home/zc/Desktop/coin_/TempNAME.csv",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "prompt",
      "Target": "Set cutoff price, be exact with commas and decimals!@1,000,000",
      "Value": "cuttoffprice",
      "Description": ""
    },
    {
      "Command": "XRunAndWait",
      "Target": "/home/zc/Desktop/coin_/bin/python",
      "Value": "/coin_/targetcheck.py",
      "Description": ""
    },
    {
      "Command": "pause",
      "Target": "3000",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "csvRead",
      "Target": "/home/zc/Desktop/coin_/Temp.csv",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!COL1}",
      "Value": "name",
      "Description": ""
    },
import csv
import pandas as pd
import os


Startfile = pd.read_csv("TempNAME.csv")
with open('TempNAME.csv', mode='r') as Startfile: 
    # creating a csv writer object 
    Startfile = csv.reader(Startfile)
    for row in Startfile:
        temp_name = Startfile.iloc[0]


df = pd.read_csv('CMC_NameSymbol.csv')

def find_name_by_symbol(temp_name):
    # Find the row where the 'Symbol' column matches the 'startstring' argument
    row = df.loc[df['Symbols'] == temp_name]

    # If no row was found, return None
    if row.empty:
        return None

    # Return the value in the 'Names' column of the row
    return row['Name'].iloc[0]

ResultName = find_name_by_symbol(temp_name)


def find_symbol_by_name(ResultName):
   
    row = df.loc[df['Name'] == ResultName]

    if row.empty:
        return None

   
    return row['Symbols'].iloc[0]

ResultSymbol = find_symbol_by_name(ResultName)

if os.path.exists("Temp.csv"):
    os.remove("Temp.csv")


with open('Temp.csv', 'w') as csvfile: 
    
    CVSwriter = csv.writer(csvfile) 
        
    
    CVSwriter.writerow([ResultName, ResultSymbol])