Sam Deane
Sam Deane

Reputation: 1623

github3.py AttributeError with IssueEvents

I've got some code which has been using github3.py successfully to iterate through issues in a repo and pull out various stats.

All of a sudden I'm getting an error when trying to iterate the events of each issue.

I'm getting the issues from a repo object with:

issues = repo.issues(assignee=user, state="open", labels=label)

I'm iterating the issues with:

for issue in issues:

passing each one to a subroutine and then iterating the events with

for event in issue.events():

This is resulting in:

AttributeError: 'IssueEvent' object has no attribute '_session'

on the second iteration of the loop.

I'm not aware of anything having changed with my code, so I'm not quite sure why I'm suddenly getting an error.

The full traceback is:

Traceback (most recent call last):
  File "issues.py", line 304, in <module>
    main()
  File "issues.py", line 300, in main
    print_user_issues(gh, sketch, since, useMarkdown)
  File "issues.py", line 282, in print_user_issues
    status = status_for_user(userLogin, gh, LABEL_MAPPINGS, since, sketch)
  File "issues.py", line 121, in status_for_user
    add_issues_to_status_for_label(issues, status, label, since)
  File "issues.py", line 96, in add_issues_to_status_for_label
    wasNew = is_issue_new_since_stroll(issue, since)
  File "issues.py", line 68, in is_issue_new_since_stroll
    for event in issue.events():
  File "/Library/Python/2.7/site-packages/github3/structs.py", line 95,   in __iter__
    yield cls(i)
  File "/Library/Python/2.7/site-packages/github3/models.py", line 130, in __init__
    super(GitHubCore, self).__init__(json)
  File "/Library/Python/2.7/site-packages/github3/models.py", line 37, in __init__
    self._update_attributes(json)
  File "/Library/Python/2.7/site-packages/github3/issues/event.py", line 69, in _update_attributes
    self.assignee = User(self.assignee, self._session)
AttributeError: 'IssueEvent' object has no attribute '_session'

Upvotes: 1

Views: 119

Answers (1)

Ian Stapleton Cordasco
Ian Stapleton Cordasco

Reputation: 28757

I had a chance to look this up and I found that this is a bug introduced during the work on 1.0 (which is yet unreleased).

Upvotes: 1

Related Questions