0

This is the error that is being displayed in the console output. Given the specific path to the python config. Also specified the path in both system and user environment variables.

Running as SYSTEM
Building on master in workspace C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\pyproj
[pyproj] $ python C:\Windows\TEMP\jenkins1868508063547381339.py
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.base/java.lang.ProcessImpl.create(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:487)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program "python" (in directory "C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\pyproj"): CreateProcess error=2, The system cannot find the file specified
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at hudson.Proc$LocalProc.<init>(Proc.java:253)
    at hudson.Proc$LocalProc.<init>(Proc.java:222)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
    at hudson.Launcher$ProcStarter.start(Launcher.java:508)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:144)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
    at hudson.model.Build$BuildExecution.build(Build.java:199)
    at hudson.model.Build$BuildExecution.doRun(Build.java:164)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
    at hudson.model.Run.execute(Run.java:1889)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:100)
    at hudson.model.Executor.run(Executor.java:433)
Build step 'Execute Python script' marked build as failure
Finished: FAILURE
  • That's not a shell script; you are trying to execute a Python script. If you really wanted to execute a shell script, change the build action from "Execute a Python script" to "Execute a shell script" (though Windows is unlikely to have a Unix-compatible shell installed by default, either). – tripleee Aug 30 '21 at 07:51
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 01 '21 at 08:47

1 Answers1

0

It's complaining that it can't find python. You have not specified a full path to the Python binary.

Are you sure Python is even installed on this system?

Depending on how and where it was installed, try adding something like c:\python39 to your PATH; see How to set the PATH environment variable in Jenkins configuration on Windows? for details.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • On non-Windows OSes, this is somewhat more straightforward, though if you have installed a custom Python in some weird place like `/opt/extras/python` you would have to add that to the front of your `PATH` to convince Jenkins to use that custom version, quite similarly. (Though maybe instead add a symlink from `/usr/local/bin/python` to the Python binary you want to use.) – tripleee Aug 30 '21 at 07:50