hi
i have python script polling jira for every 5 min .
updated_issues = jira.search_issues(f' project = {jira_project_key} and updated >= "-12h" ',json_result=True)
issues = updated_issues["issues"]
for item in issues:
try: jissue = JIRA_Issue.objects.get(jira_key=item['key'])
except JIRA_Issue.DoesNotExist:
continue
desc=''
if jissue.finding is not None:
jissue.finding.severity = item['fields']['customfield_10605']['value'] desc = item['fields']['description']
i am getting this error
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr__
return self[item]
TypeError
'CustomFieldOption' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr__
[2021-03-16 06:09:03,360: WARNING/MainProcess] return self[item]
TypeError
Hi @Akiti Bala ,
welcome to the Atlassian Community!
I'm not a python specialist, but after the quick check of your code, this line is suspicious for me:
jissue.finding.severity = item['fields']['customfield_10605']'value']
I believe it should be:
jissue.finding.severity = item['fields']['customfield_10605']['value']
(missing bracket)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
to be honest, it is complicated to understand, what you are trying to achieve.
Which line has number 161?
Which type has your customfield_10605? Select List (single choice)?
Could you please paste here the whole code?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Hana Kučerová ,
The line 161 is in jira python client :
File "/usr/local/lib/python3.6/site-packages/jira/resources.py", line 161, in __getattr_
the custom_field_10605 is Severity choice .It may be High,Low,Medium,Info.
when i am trying to get custom field for updating local DB, it throws error .
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think this line
jissue.finding.severity = item['fields']['customfield_10605']['value']
is causing the error: 'CustomFieldOption' object is not subscriptable
CustomFieldOption object is something, which is returned, when you get value from
Select List (single choice) custom field.
Hopefully this article will help you to fix it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.