You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Iterating through repo.get_tags() throws NoneType TypeError for repositories with lots of tags #278
For repositories with lots of tags (git, linux, etc.), iterating through repo.get_tags() throws a NoneType TypeError. Please see the following for the steps to recreate:
eric@white:~/autoport> pip freeze|ack pygithub
PyGithub==1.25.0
eric@white:~/autoport> python
Python 2.7.3 (default, Feb 27 2014, 20:00:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from github import Github
>>> tags = Github("...").get_repo(2325298).get_tags()
>>> for tag in tags:
... print tag
...
<github.Tag.Tag object at 0xb6e1848c>
<github.Tag.Tag object at 0xb6e18e8c>
...
<github.Tag.Tag object at 0xb6d14b0c>
<github.Tag.Tag object at 0xb6d14c0c>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/github/PaginatedList.py", line 48, in __iter__
newElements = self._grow()
File "/usr/local/lib/python2.7/dist-packages/github/PaginatedList.py", line 60, in _grow
newElements = self._fetchNextPage()
File "/usr/local/lib/python2.7/dist-packages/github/PaginatedList.py", line 177, in _fetchNextPage
for element in data
File "/usr/local/lib/python2.7/dist-packages/github/GithubObject.py", line 74, in __init__
self._storeAndUseAttributes(headers, attributes)
File "/usr/local/lib/python2.7/dist-packages/github/GithubObject.py", line 86, in _storeAndUseAttributes
self._useAttributes(attributes)
File "/usr/local/lib/python2.7/dist-packages/github/Tag.py", line 73, in _useAttributes
if "commit" in attributes: # pragma no branch
TypeError: argument of type 'NoneType' is not iterable
The team deployed some changes which should have resolved this issue. Let us know if you're still seeing null items in some responses, though.
Thanks again!
Activity
jacquev6 commentedon Oct 6, 2014
Wow thanks for reporting that! I'll have a look in the coming days.
jacquev6 commentedon Oct 8, 2014
The issue comes from the GitHub API (see the
nulls at the end):I'll contact GitHub to see if they can fix it on their side. I'll also make a workaround in PyGithub.
jacquev6 commentedon Oct 8, 2014
Work-around in aadc286 and https://pypi.python.org/pypi/PyGithub/1.25.2
Thanks for reporting!
jacquev6 commentedon Oct 8, 2014
Response from Ivan Žužak (GitHub Support):
erichaase commentedon Oct 8, 2014
Great, thanks for the quick turnaround on this!
Don't try to parse "data" if it's None