2013-11-22 112 views
0

无法截图附加到使用Windows 7机器上吉拉的Python库中的问题,截图给JIRA问题。我正在使用“rb”选项打开“.PNG”文件,但仍出现UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 208: character maps to <undefined>错误。 也只是'r'打开文件选项文件被上传,但大小为0.0 kb。 这里是代码片段:无法附加使用JIRA Python库

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

您有:

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

看来,你有你的参数错误的方式,围绕

见注释这里: [https://answers.atlassian.com/questions/138053/jira-python-attached-file-filename]

姆:只要遇到另一个链接: [http://jira-python.readthedocs.org/en/latest/_modules/jira/client.html] ,其具有:

DEF add_附件(个体经营,发行,附件,文件名=无):

也许更好的使用:

jira.add_attachment(issue_obj,附件= imgfile,文件名= “abc.PNG”)