Two pits with Jenkins operation error

Jenkins was configured in the tutorial yesterday, but there are always errors. Summarize the two problems encountered

1. It can run normally in pycharm, but the error “no module named ‘xxx” is always reported under Jenkins. It is also reported by using the command line alone. The reason for checking online is

In pycharm, all folder paths of the current project will be used as the package search path at runtime, while only the current path will be searched by default on the command line, and the package will not be found

To solve this problem, I used a stupid method to add the paths of the current folder to the search path through sys. Path. Append()

After adding the path, run the code from the command line successfully

2. The second problem is that after running successfully through the command line, Jenkins still reports an error. It reports that the module in the python directory cannot be found. After checking, it is said on the Internet that Jenkins may have permission to read some folders

The solution is as follows

Run – > services.msc

Find Jenkins


Right click – properties – login – this account

Select an account with permission (you must have a login password, otherwise an error will occur when restarting the service)

After application, restart the service


Rebuild in Jenkins and run successfully


Similar Posts: