2013-11-22 111 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」)