We've been using multiple Python scripts to manage specific projects within our cloud-based Jira instance for some time.
Today, one of our scripts began failing when attempting to retrieve "issue.fields.reporter.name" with TypeError: argument of type 'NoneType' is not iterable
This is a fairly simple script attempting to check if there is a "due date" set, and if not, write a friendly little comment to the reporter indicating they did not set a "due date".
Code block looks like:
...
logger.debug('Issues to upate: %s', issuesToUpdate)
logger.debug('Next deploy day: %s', next_deploy_day.strftime('%m-%d-%Y'))
for issue in issuesToUpdate:
reporter = issue.fields.reporter.name
comment = '[~' + reporter + '] No due date was assigned so I set it to '
comment += 'the upcoming deployment on' + next_deploy_day.strftime('%A')
...
Output for this section looks like:
DEBUG:__main__:Issues to upate: [<JIRA Issue: key=u'DEPLOY-8943', id=u'86080'>]
DEBUG:__main__:Next deploy day: 11-20-2018
Traceback (most recent call last):
File "updateDeployDueDate.py", line 151, in <module>
main()
File "updateDeployDueDate.py", line 65, in main
reporter = issue.fields.reporter.name
File "/srv/virtualenv/jirabot/local/lib/python2.7/site-packages/jira/resources.py", line 128, in __getattr__
if hasattr(self, 'raw') and item in self.raw:
TypeError: argument of type 'NoneType' is not iterable
Weird thing is if I step through this function and attempt some prints along the way (specifically on this issue print issue.raw['fields']['reporter']) I get the following (I modified these values to protect the innocent):
>>>[stdout:]{u'displayName': u'XXXXX', u'name': u'XXXXX', u'self': u'https://XXXXX.atlassian.net/rest/api/2/user?accountId=XXXXX', u'avatarUrls': {XXXXX}, u'emailAddress': u'XXXXX', u'key': u'XXXXX', u'active': True, u'timeZone': u'America/New_York', u'accountId': u'XXXXX'}
I've checked the DEPLOY issue itself, and there is clearly a reporter, and looking at this output it looks like issue.fields.reporter.name is definitely set.
We are still running jira 1.0.3 python package, and I do believe there is a 2.x out there; but I am unable to find anything that indicates this is deprecated at this point. Any help would be lovely.