I have a SQL Server Agent job that executes some python scripts using CmdExec. Everything is set up with a proxy account as expected.

When I run the job I get:

Message Executed as user: domain\proxyaccount. 'python' is not recognized as an internal or external command, operable program or batch file. Process Exit Code 1. The step failed.

I'm using Anaconda and Python is in the system PATH variable. When I run python from command line, it works. When I run python cutting and pasting the specific command from the job, it works. When I use runas to mimic the proxy account it works. The only place Python doesn't run is form inside the job.

What else do I need to look at to trouble shoot this issue?

1 Answers

1
Sergey Nudnov On Best Solutions

You should restart SQL Server Agent after you installed Python on the server.

It is necessary for SQL Server Agent to load new environment variables, including the updated PATH with Python in it.

There are also suggestions to restart SQL Server too, but I believe restarting SQL Server Agent will be enough.