Hello guys, this is a script which last used 3 month ago with no problem. Now search_issues() raises TypeError (my jira-python module version was 3.8/ I updated to 3.10.1 and still there is error)
File "C:\Work\Report\JiraConnector.py", line 11, in execute_query
issues = self.jira.search_issues(query + self.additional_restrictions, fields=["id"], maxResults=5000)
File "C:\Work\Report.venv\lib\site-packages\jira\client.py", line 3685, in search_issues
if k in iss.raw.get("fields", {}):
TypeError: argument of type 'NoneType' is not iterable
The actual data in iss.raw contains the parameter "fields" with value None. Is it a change in this module or a change in JIRA API itself that made the problem?
Thanks.
Welcome to the Atlassian Community!
I haven't encountered any issues like that while using the Jira Python library.
I ran a quick test script to check if the required function works — and it successfully searched for and returned issues.
I'm using package jira
jira==3.8.0
from jira import JIRA
from jira.exceptions import JIRAError
JIRA_SERVER = "https://your-site.atlassian.net "
JIRA_USER_EMAIL = "you@example.com"
JIRA_API_TOKEN = "your_api_token"
JQL_QUERY = 'project = PRJ'
def connect_to_jira():
try:
jira = JIRA(
server=JIRA_SERVER,
basic_auth=(JIRA_USER_EMAIL, JIRA_API_TOKEN)
)
print("✅ Successfully connected to Jira Cloud")
return jira
except JIRAError as e:
print(f"❌ Failed to connect to Jira: {e}")
return None
def search_issues(jira, jql):
try:
issues = jira.search_issues(
jql_str=jql,
maxResults=50, # Change if you want more results
fields=['summary', 'status', 'assignee']
)
print(f"\n🔍 Found {len(issues)} issue(s):\n")
for issue in issues:
assignee = issue.fields.assignee.displayName if issue.fields.assignee else "Unassigned"
print(f"{issue.key}: {issue.fields.summary} | Status: {issue.fields.status.name} | Assignee: {assignee}")
return issues
except JIRAError as e:
print(f"❌ Error during issue search: {e}")
return []
if __name__ == "__main__":
jira_client = connect_to_jira()
if jira_client:
search_issues(jira_client, JQL_QUERY)
/python /scratches/test.py
✅ Successfully connected to Jira Cloud
🔍 Found 50 issue(s):
PRJ-84: TEST | Status: Backlog | Assignee: Unassigned
PRJ-83: PRJ-83 | | Status: Backlog | Assignee: Unassigned
PRJ-82: TEST DEFECT ISSUE | Status: Backlog | Assignee: Unassigned
...
...
...
PRJ-38: 234 | Status: Backlog | Assignee: Unassigned
PRJ-37: AUTO TEST ISSUE - TEST SubTask | Status: Backlog | Assignee: Unassigned
PRJ-36: AUTO TEST ISSUE | Status: Done | Assignee: Unassigned
PRJ-35: AUTO TEST ISSUE - TEST SubTask | Status: Backlog | Assignee: Unassigned
Process finished with exit code 0
Thank you @Evgenii
I used your tester as base and found out where the problem is.
If you just ask for the field "id" in search_issues(), which is my case, you get the type error. Otherwise, for other fields (even id with other fields) I could successfully get data back.
issues = jira.search_issues(
jql_str=jql,
maxResults=50, # Change if you want more results
fields=['id']
)
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.