无法使用JIRA Python库将屏幕截图附加到JIRA问题

时间:2013-11-22 22:01:46

标签: python python-jira

无法在Windows 7计算机上使用Jira-Python库将屏幕截图附加到问题。我使用'rb'选项打开“.PNG”文件,但仍然出现UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 208: character maps to <undefined>错误。 只有'r'打开文件选项,文件上传但大小为0.0 kb。 以下是代码段:

from client import JIRA
jira_options={'server': JIRA_URL}
jira=JIRA(options=jira_options,basic_auth=(usrname,passwd))
issue_obj = jira.issue([new_issue_id])
fileimgpath = "C:/installers/abc.PNG"
imgfile = open(fileimgpath,"rb")
jira.add_attachment(issue_obj,imgfile,"abc.PNG")

谢谢你的帮助。

1 个答案:

答案 0 :(得分:1)

你有:

jira.add_attachment(issue_obj,imgfile,"abc.PNG")

您的参数似乎是错误的方式

在此处查看评论:    [https://answers.atlassian.com/questions/138053/jira-python-attached-file-filename]

Humm:刚刚遇到另一个链接:     [http://jira-python.readthedocs.org/en/latest/_modules/jira/client.html] 它有:

def add_attachment(self,issue,attachment,filename = None):

也许更好用:

jira.add_attachment(issue_obj,attachment = imgfile,filename =&#34; abc.PNG&#34;)