SQL Server Agent Run Python Script Issue

51 Views Asked by At

I can run basic Python scripts from SQL Server Agent using the CmdExec to run a bat file pointing to my py file that prints hello world. However when trying run a file that uses the pandas module the Agent keeps coming up with the error below:

import pandas as pd File "C:\...\Python\Python39\lib\site-packages\pandas\__init__.py"<c/> line 47<c/> in <module> raise ImportError( ImportError: Unable to import required dependencies: dateutil: No module named 'dateutil'. Process Exit Code 1

The test code I am trying to execute is below:

import pandas as pd

lst=['a','b','c']

df=pd.DataFrame(lst)
df.to_csv(r'C:\Test.csv',index=False)

Seeing if you had any suggestions?

1

There are 1 best solutions below

4
Sneh Gurdasani On

Try pip install python-dateutil