0

I use Python JIRA library to export project content. Most of the fields are normal to catch, except the comments. Below is my codes, need help to point out what is the error. Why it come out with error: Thank you very much.

"Traceback (most recent call last):
    comments=item.fields.comment.comments
AttributeError: type object 'PropertyHolder' has no attribute 'comment'". 
from jira import JIRA
import pandas as pd
import openpyxl

jira = JIRA("http://jira-ep.ecp.priv")
block_size = 1000
block_num = 0
allissues = []

while True:
    start_idx = block_num * block_size
    issues = jira.search_issues(
        'project=PRJ0404 and type=DFM',
        start_idx,
        block_size
    )

    if len(issues) == 0:
        break

    block_num += 1

    for issue in issues:
        allissues.append(issue)

dfm = pd.DataFrame()

for item in allissues:
    d = {
        'key': item.key,
        'PCB': item.fields.customfield_10424,
        'Summary': item.fields.summary,
        'Severity': item.fields.customfield_10323,
        'Description': item.fields.description,
        'Reporter': item.fields.reporter,
        'Assignee': item.fields.assignee,
        'Create Stage': item.fields.customfield_10324,
        'Created Date': item.fields.created[0:10],
        'Updated Date': item.fields.updated[0:10],
        'Status': item.fields.status,
    }
    solution = ""
    comments = item.fields.comment.comments
    for comment in comments: # Get DFM comment filed content
        solution = comment.created[0:10] + 
            " " + 
            str(comment.author.name) + 
            ": " + 
            comment.body
    d = {'Solution': solution}
    dfm = dfm.append(d, ignore_index=True)
accdias
  • 5,160
  • 3
  • 19
  • 31

0 Answers0