Execute failed: output_table_1 is not defined.

Hello,

I have a python script that is running locally on my Spyder program.
I would like to run it now within KNIME.
But I havent understand the concept in general. I am getting always the message: Execute failed: output_table_1 is not defined.

if __name__ == '__main__':
    # Define the URL to crawl
    url = input_table_1['web']

    # Create a session object to maintain a persistent connection
    session = requests.Session()

    # Crawl the website and extract data for the first level of links
    page_data = [crawl_website(url, session)]
    
    # Write the data to a CSV file
    write_to_csv(page_data, 'output.csv')

The input seems to work, but I dont know how to define the output.
From my naiv understanding I am writing the following, but this doesnt work:

# Write the data to a CSV file
output_table_1 = page_data

I guess this is more a python question than KNIME, but maybe someone can give me a hint?

@wantti you might want to explore these articles and the samples from this space:

https://docs.knime.com/latest/python_installation_guide/#_introduction

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.