jfrog / artifactory-scripts

Scripts for Artifactory (Usually, for REST API), community driven.
Apache License 2.0
148 stars 166 forks source link

_ElementInterface instance has no attribute 'iter' error #8

Closed aldaris closed 8 years ago

aldaris commented 8 years ago

When running the packageCheck.py script with Python 2.6.9, I've been running into the following error message:

$ ./packageCheck.py http://localhost:8080/artifactory
Getting repository list
Authorization required
Username: admin
Password: 
Traceback (most recent call last):
  File "./packageCheck.py", line 178, in <module>
    try: sys.exit(PackageCheck(getargs()).status)
  File "./packageCheck.py", line 33, in __init__
    for key, types in self.getRepoList(args, auth):
  File "./packageCheck.py", line 124, in getRepoList
    for repo in root.iter(ns + name + "Repository"):
AttributeError: _ElementInterface instance has no attribute 'iter'

The fix for me was to change line 124 from:

            for repo in root.iter(ns + name + "Repository"):

to:

            for repo in root.getiterator(ns + name + "Repository"):
DarthFennec commented 8 years ago

Element.getiterator is deprecated since Python 2.7, in favor of Element.iter. For earlier versions of Python, packageCheck.py now uses getitorator when iter does not exist. Please check if this has fixed the problem for you.

aldaris commented 8 years ago

Thanks, I can confirm that with the new version I was able to run the script without any problems.