While using jenkins API, getting a failure on reconfig_job
Your script is probably importing wrong module. You can check it as follows:
import jenkinsprint 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 sysprint 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
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.
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