Skip to content Skip to sidebar Skip to footer

While Using Jenkins Api, Getting A Failure On Reconfig_job

I am using jenkins rest API to recurse through jobs and then reconfigure this one. All methods work except one. He's is my code : def get_server_instance(): jenkins_url = 'xxxx

Solution 1:

Your script is probably importing wrong module. You can check it as follows:

import jenkins
print jenkins.__file__

If printed path is other than installation path of jenkins module (eg. C:\Python27_32\lib\site-packages\jenkins\__init__.pyc), then you should check pythonpath:

import sys
print sys.path

Common problem is existence of python script with same name as imported module in current directory, which is at the first place in search path ''.

For more info on import order see module search path

Solution 2:

Following @Chemik answer, I realized that the script I wrote was named jenkins.py and it was conflicting with python-jenkins import.

The library isn't broken. Check your script name.

Solution 3:

had to add another solution, while running the same command

server = jenkins.Jenkins(jenkins_url, username = '', password = '')

i got the error:

'jenkins' has no attribute 'Jenkins'

my mistake was when installing the package, i installed package "jenkins" and the package i was needed is "python-jenkins". docs can be found: python-jenkins docs

so what i had to do is just

pip install python-jenkins

Post a Comment for "While Using Jenkins Api, Getting A Failure On Reconfig_job"