Today try to deploy our automation project on Jenkins, configure it with simple login use cases, and then our project (which I write myself) using Python+selenium,
After setting up the environment, the construction of the time encountered a problem, is always prompted to find my own definition of the module package, prompting the error
modulenotfounderror:no module named ' Common ', as follows:
But I run in the IDE in the Pycharm is normal, do not give up in Cmd run a bit, found with Jenkins above the same problem, and then Baidu a bit finally found the problem lies
Cause: When the IDE is running, all relevant modules are searched, while the cmd command or Jenkins build will only search for modules in the current directory
Workaround:
Project Name: Test
Path of the project in the computer: D:\workspace\test
The working directory for Jenkins builds is: C:\Program Files (x86) \jenkins\workspace\test
1, if running in cmd, you need to configure the system environment variables
Name = PYTHONPATH
Value = D:\workspace\test
2. When building on Jenkins, you need to find the global properties in the System management-system settings in the Jenkins home page to fill in the relevant
Then click Save, rebuild it should be done
Jenkins when you deploy a Python project, you are prompted to find a problem with the module package that you defined