How executing python file?


I’m new using Jenkins. My goal is to run a unitest python file on Jenkins. My environment is Windows 10 with a Jenkins version 2.387.1. I’ve installed the default plugins and the additional python. The python file was created in Anaconda (Spyder) with a version of python 3.9.

The python code is the following:

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
from import WebDriverWait
from import expected_conditions as EC
from import By
import unittest

class TestURLs(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))

    def tearDown(self):

    def test_multiple_urls(self):
        urls = [

        for url in urls:
            # Navigate to the URL
            wait = WebDriverWait(self.driver, 10)
if __name__ == '__main__':

I’ve created a Freestyle Project with a Build Steps as Execute Shell with the following commands:

python -m unittest C:\Users\user\

When I Build Now the project, I do not get any response. What I’m missing?
Thank in advanced.

When you say you don’t get any response, what do you mean by that? What are you trying to do with the cd\ that you have in your job?

By no response, I meant there is not output. The cd\ is to go to the root of the path. More details about my code is that the python file is executed within an anaconda virtual environment. I don’t know if this affects the procedure. I stack on how to configure the project to setup a job capable of executing a python file.

I’ve installed the appropriate libraries to make it run outside the virtual environment and following this steps on cmd I could make it work, however, I put the same commands inside the execute shell

cd C:\Users\user\
py -m multicooki

and by clicking Build Now, it remains here

your script has no output, no prints or anything.

also can you share your pipeline?

Well, this script has not print, however, the one executed does. About the pipeline, I didn’t configured one? it should be linked to the created project? How should I configured it? Apologies for too much questions.

You wrote you’re on windows but then you mentioned to use “execute shell”. Shell will only work on Unix, in a Freestyle project you need to use “execute windows batch”.

You posted a picture where one can see that you might have a misconfiguration in your job. You assigned a label where to execute the job but there is no agent available that has this label. So the job will never start.

@mawinter69 I’ve changed shell to batch and I’ve created an agent with the project name. I could executed it, however, I get this console output:

Started by user [rparada](http://localhost:8080/user/rparada) Running as SYSTEM Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\pythonCookies [pythonCookies] $ cmd /c call C:\Windows\TEMP\jenkins3692175436805402094.bat C:\ProgramData\Jenkins\.jenkins\workspace\pythonCookies>cd\ C:\>cd C:\Users\user\ C:\Users\user>py -m multicooki No installed Python found! C:\Users\user>exit 112 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE

I have installed all possible python plugins (with restart). The code works locally following the same steps. Why it says No installed Python found?


hard to tell why it is not found.
When you installed python did you install it as administrator making it available for all users? If not are you running your agent with the same user account used to install python?

I was wrong, I didn’t configure an agent it was the in-built node. I’ve seen different ways to configure the agent. Please, could you recommend me a link? I’ve seen this procedure How to Install Jenkins Agent on Windows - YouTube