Feb-15-2019, 05:01 PM
I am new to python. I am using Python 3 and I am trying to execute a PYTHON script that is only combining 2 csv files via a .bat file in SQL Server 2016 Agent job but getting an error. ALL files, the .bat, .csv files and the .py files all sit in the SAME share directory. Any help/direction would be appreciated. Thanks.
Here is my what is in my .bat file:
python \\abicfs2\shared\dev\DATAEXPORT\MonthlyReports\combineCSVFiles.py
Here is the code in the combineCSVFiles.py file:
Here is my what is in my .bat file:
python \\abicfs2\shared\dev\DATAEXPORT\MonthlyReports\combineCSVFiles.py
Here is the code in the combineCSVFiles.py file:
import os filename0 = os.path.join(os.path.dirname("BoundPoliciesAddedAtFaultEndorsementWithin10Days_Combined.csv")) filename1 = os.path.join(os.path.dirname("BoundPoliciesAddedAtFaultEndorsementWithin10Days_Counts.csv")) filename2 = os.path.join(os.path.dirname("BoundPoliciesAddedAtFaultEndorsementWithin10Days_Details.csv")) f = open(filename0, "w+") f.close() fin1 = open(filename1, "r") data1 = fin1.read() fin1.close() fin2 = open(filename2, "r") data2 = fin2.read() fin2.close() fout = open(filename0, "a") fout.write(data1) fout.write(data2) fout.close()Here is the error I'm getting in the SQL Server agent job:
Quote:Message Executed as user: domain\sqlsvcAA. C:\Windows\system32>python \abicfs2\shared\dev\DATAEXPORT\MonthlyReports\combineCSVFiles.py
Traceback (most recent call last): File "\abicfs2\shared\dev\DATAEXPORT\MonthlyReports\combineCSVFiles.py", line 9, in f = open(filename0, "w+") FileNotFoundError: [Errno 2] No such file or directory: ''. Process Exit Code 1. The step failed.