尝试为Jira问题对象调用add_attachment时出现“ RuntimeError:字典键在迭代过程中更改”,但是不使用字典吗?

aapl

我试图将一个csv文件添加到我的问题中作为测试,但我一直收到错误消息:

RuntimeError: dictionary keys changed during iteration

这是代码(我已经删除了服务器,用户名和密码的参数):

from jira import JIRA

options = {"server": "serverlinkgoeshere"}
jira = JIRA(options, basic_auth=('username', 'password'))
issuesList = jira.search_issues(jql_str='', startAt=0, maxResults=100)
for issue in issuesList:
    with open("./csv/Adobe.csv",'rb') as f:
        jira.add_attachment(issue=issue, attachment=f)
    f.close()

我很茫然,我没有更改代码中的任何字典键。这是完整的错误消息:

Traceback (most recent call last):
  File "C:/Users/USER/PycharmProjects/extractor/main/jiraCSVDupdate.py", line 8, in <module>
    jira.add_attachment(issue=issue, attachment=f)
  File "C:\Users\USER\AppData\Roaming\Python\Python38\site-packages\jira\client.py", line 126, in wrapper
    result = func(*arg_list, **kwargs)
  File "C:\Users\USER\AppData\Roaming\Python\Python38\site-packages\jira\client.py", line 787, in add_attachment
    url, data=m, headers=CaseInsensitiveDict({'content-type': m.content_type, 'X-Atlassian-Token': 'nocheck'}), retry_data=file_stream)
  File "C:\Users\USER\AppData\Roaming\Python\Python38\site-packages\jira\utils\__init__.py", line 41, in __init__
    for key, value in super(CaseInsensitiveDict, self).items():
RuntimeError: dictionary keys changed during iteration

参考:Jira add_attachment示例:https ://jira.readthedocs.io/en/master/examples.html#attachments

add_attachment源代码:https ://jira.readthedocs.io/en/master/_modules/jira/client.html#JIRA.add_attachment

招数

我在python 3.8中面临同样的问题。但是,当我使用python 3.7解释器时,它的工作正常。我不确定这是否是解决方案,但它对我有用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章