I am trying to run a Python script from the SSIS Execute Process Task. I am getting the following error. I've tried looking around stackoverflow, but cannot seem to find a suitable answer to my problem.
SSIS package "C:\Users\Q300L\source\repos\TestScript\Package.dtsx" starting.
Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" "C:\Users\Q300L\Desktop\GGTT.py" at "", The process exit code was "1" while the expected was "0".
Task failed: Execute Process Task
Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "C:\Users\Q300L\source\repos\TestScript\Package.dtsx" finished: Failure.
Process details.
My Python script is a simple web scraping that takes the SPY companies from a wikipedia table.
import csv
import requests
import pandas as pd
from bs4 import BeautifulSoup
website_url = requests.get("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies").text
soup = BeautifulSoup(website_url, 'html.parser')
My_table = soup.find('table', attrs={"id":"constituents"})
counter_ = 0
df = pd.DataFrame(columns=["symbol", "security", "SEC_fillings", "GICS_Sector", "Headquarters_Location", "Date_first_added", "CIK", "Founded"])
for tr in My_table.find_all('tr'):
counter_ += 1
tds = tr.find_all('td')
if not tds:
continue
tmp_list = []
for td in tds[:8]:
tmp_list.append(td.text.strip())
df.loc[counter_] = tmp_list
df.to_csv("C:/Users/Q300L/Desktop/Rich/Staging/SPY.csv", encoding='utf-8', index=False)
But the code gives me the error mentioned above. The code runs fine in both IDLE and Visual Studio Code. And succesfully creates a file with the scraped data.
I did try run a more simple task of creating a file with SSIS Execute Process Task, to get a minimum viable product up and running. The below code runs just fine, when executing my SSIS package:
import csv
with open('C:/Users/Q300L/Desktop/innovators.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(["SN", "Name", "Contribution"])
writer.writerow([1, "Linus Torvalds", "Linux Kernel"])
writer.writerow([2, "Tim Berners-Lee", "World Wide Web"])
writer.writerow([3, "Guido van Rossum", "Python Programming"])
I also tried to make a simple python script with import csv and nothing else. Which runs fine, when I then add the next import requests it starts to complain, and throws the same error.
I'm hoping some may point me in the right direction. Thanks!
